Iva*_*gin 2 apple-push-notifications node.js
我见过节点模块"node-apn",但我看不出如何在一个连接中向多个用户发送相同的通知?我也看到可以用PHP做,但我使用的是node.js
arg*_*gon 11
使用node-apn v1.3.x(强烈推荐的升级),您可以向许多设备发送相同的通知,而根本不需要循环.该模块将自动处理围绕向您发送一个通知给多个设备的复杂情况.
// Instantiate a new message
// and set message defaults
var note = new apns.Notification();
note.expiry = Math.floor(Date.now() / 1000) + 3600; // Expires 1 hour from now.
note.badge = 3;
note.sound = "ping.aiff";
note.alert = "You have a new message";
note.payload = {'messageFrom': 'Caroline'};
// List of user tokens
var userTokens = ['token1', 'token2', 'token3'];
// Send the message
apnsConnection.pushNotification(note, userTokens);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3324 次 |
| 最近记录: |