简体   繁体   English

如何通过node.js Bluemix push API注册设备

[英]How to register a device through node.js Bluemix push API

We are developing a mobile application. 我们正在开发一个移动应用程序。 First, we put the registration option in mobile (Bluemix js Push API). 首先,我们将注册选项放在移动设备(Bluemix js Push API)中。 But, for a security reason, we moved all (register device, push devicebyid,tag ..) options to node.js server. 但是,出于安全原因,我们将所有(注册设备,push devicebyid,tag ..)选项都移至了node.js服务器。 I use the node.js Bluemix Push API, but I didn't find a register device option there. 我使用了node.js Bluemix Push API,但没有在其中找到注册设备选项。

I installed: 我安装了:

npm install ibmbluemix
npm install ibmpush

I wrote the following function on the server side: 我在服务器端编写了以下函数:

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);
     });

Please help me register a device through the node.js Push API. 请帮助我通过node.js Push API注册设备。

Assuming you are using an MBaaS backend application, there is not currently a way to register a device through the Node.js Push API. 假设您使用的是MBaaS后端应用程序,那么当前尚无法通过Node.js Push API注册设备。 You can find the javascript API documentation for Push here: 您可以在此处找到用于Push的javascript API文档:

https://mobile.ng.bluemix.net/mbaas-api/docs/JavaScript/IBMPushService.html https://mobile.ng.bluemix.net/mbaas-api/docs/JavaScript/IBMPushService.html

If you are using an IMF backend application, you can use the REST API to register a device. 如果使用的是IMF后端应用程序,则可以使用REST API来注册设备。 You can find the IMF REST API documentation here: 您可以在此处找到IMF REST API文档:

https://mobile.ng.bluemix.net/imfrestapi/imfswagger/docs#!/push/registerDevice_post_15 https://mobile.ng.bluemix.net/imfrestapi/imfswagger/docs#!/push/registerDevice_post_15

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM