node.js - 如何通过 Node.js Bluemix 推送 API 注册设备

标签 node.js push ibm-cloud

我们正在开发移动应用程序。首先,我们将注册选项放在移动设备中(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/

相关文章:

javascript - 第一次运行时网站运行速度变慢?

node.js - 使用 Google 的 reCAPTCHA 进行功能测试 Node/Express 应用程序

node.js - 使用 websockets 手动连接到 socket.io 1.x,容量测试

git - 递归 Git 推/pull ?

node.js - 为什么我的时间戳字段在将数据嵌入到 map 列表中后变成时间 map ?

javascript - 如何从 ajax 将元素推送到数组 - jQuery

ajax - 在手机上运行的 Web 应用程序与服务器之间进行实时双向通信的最佳解决方案是什么?

gradle - 如何使用bmuschko/gradle-docker-plugin通过Gradle自动将文件复制到IBM Containers中正在运行的docker

java - 无法通过 docker java 运行时从 ibm 云函数操作获取结果 json

swift - 当我尝试在 Xcode 中导入 VisualRecognitionV3 时,它给出了用 swift 3.0 编译的错误模块无法在 swift 3.0.2 中导入?