有没有办法从服务器 clear/set 本地通知?

Is there a way to clear/set local notifications from the server?

我正在使用 meteor.js 和 local notifications。我可以使用

cordova.plugins.notification.local.cancel([1, 2], function () {
    // Notifications were cancelled
}, scope);

从移动设备上清除本地通知,但如果我想从另一个设备上清除本地通知,有什么办法吗?device/computer或者我需要使用推送通知吗?

我没用过那个包,但应该可以做这样的事情:

Notifications = new Mongo.Collection("notifications");

if (Meteor.isClient) {
  Tracker.autorun(function() {
    var messages = Notifications.find({}).fetch();  // trigger autorun on change to collection
    console.log('cancel notification');
    cordova.plugins.notification.local.cancel([1, 2], function() {
      // Notifications were cancelled
    }, scope);
  });
}

if (Meteor.isServer) {
  Meteor.methods({
    cancelNotification: function() {
      Notifications.insert({message: 'cancel Notification'});
    },

  });
}
一个客户端中的

Meteor.call('cancelNotification') 将触发所有 connected 客户端中的自动运行。使用更多代码(过滤后的发布逻辑),您可以针对特定客户端,and/or 特定通知。