Javascript 解析web应用程序凭据并将推送发送到不同的凭据

Javascript 解析web应用程序凭据并将推送发送到不同的凭据,javascript,push-notification,parse-platform,Javascript,Push Notification,Parse Platform,我正在创建一个web应用程序并使用Parse来管理用户,我使用我的Parse applicationID和JavaScriptId Parse.initialize("my-app-id", "my-js-id"); Parse.User.logIn(username, password,... 当用户登录到该站点时,他/她输入属于其移动应用程序的解析应用程序id和js id,以便将通知推送到该应用程序。网站向他们发送通知: Parse.initialize("their-android-ap

我正在创建一个web应用程序并使用Parse来管理用户,我使用我的Parse applicationID和JavaScriptId

Parse.initialize("my-app-id", "my-js-id");
Parse.User.logIn(username, password,...
当用户登录到该站点时,他/她输入属于其移动应用程序的解析应用程序id和js id,以便将通知推送到该应用程序。网站向他们发送通知:

Parse.initialize("their-android-app-id", "their-android-js-id");
Parse.Push.send({ where: new Parse.Query(Parse.Installation), data: ...

我不清楚何时调用initialize,以及如何区分我的javascript应用程序和我想要发送到的android/iOS应用程序

据我所知,不可能将同一个api与两个不同的api键一起使用。我认为对应用程序A使用普通JavaScript API是最简单的方法,但对应用程序B使用REST-API是最简单的方法,因为您只需要为应用程序B发送推送通知

在JQuery中,这可能看起来像这样的示例:

$.ajax({
     url: 'https://api.parse.com/1/push',
     type: 'post',
     data: {
         where : {
             ...
         },
         data : {
             ...
         }
     },
     headers: {
        "X-Parse-Application-Id": "their-app-id",
        "X-Parse-REST-API-Key": "their-rest-api-key",
    },
    contentType: 'application/json',
    dataType: 'json',
    success: function (data) {
        //data: response data from the Parse.com REST-API
    }
});
Parse提供了一份关于如何通过REST-API使用推送通知的指南