我们正在开发移动应用程序。首先,我们将注册选项放在移动设备中(Bluemix js Push API)。但是,出于安全原因,我们将所有(注册设备、推送 devicebyid、标签 ..)选项移至 Node.js 服务器。我使用node.js Bluemix Push API,但我在那里没有找到注册设备选项。
我安装了:
npm install ibmbluemix
npm install ibmpush
我在服务器端编写了以下函数:
ibmpush.pushNotificationAll(JSON.parse(req.body),function(response){
res.send(response);
});
ibmpush.pushNotificationDeviceIds(JSON.parse(req.body),function(response){
res.send(response);
});
ibmpush.pushNotificationAll(JSON.parse(req.body),function(response){
console.log("push sent successfully",response);
res.send(response);
});
请帮助我通过node.js Push API 注册设备。
最佳答案
假设您使用的是 MBaaS 后端应用程序,当前无法通过 Node.js Push API 注册设备。 您可以在此处找到 Push 的 javascript API 文档:
https://mobile.ng.bluemix.net/mbaas-api/docs/JavaScript/IBMPushService.html
如果您使用 IMF 后端应用程序,则可以使用 REST API 注册设备。您可以在此处找到 IMF REST API 文档:
https://mobile.ng.bluemix.net/imfrestapi/imfswagger/docs#!/push/registerDevice_post_15
关于node.js - 如何通过 Node.js Bluemix 推送 API 注册设备,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32871387/