You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
gcm.send(message, { registrationTokens: registrationTokens }, function (err, response) {
87
+
gcm.send(message, registrationTokens, function (err, response) {
88
88
if(err) console.error(err);
89
89
elseconsole.log(response);
90
90
});
91
91
92
92
// ... or retrying a specific number of times (10)
93
-
gcm.send(message, { registrationTokens: registrationTokens }, 10, function (err, response) {
93
+
gcm.send(message, registrationTokens, 10, function (err, response) {
94
94
if(err) console.error(err);
95
95
elseconsole.log(response);
96
96
});
97
97
```
98
98
99
99
## Recipients
100
100
101
-
You can send push notifications to various recipient types by providing one of the following recipient keys:
102
-
103
-
|Key|Type|Description|
104
-
|---|---|---|
105
-
|to|String|A single [registration token](https://developers.google.com/cloud-messaging/android/client#sample-register), [notification key](https://developers.google.com/cloud-messaging/notifications), or [topic](https://developers.google.com/cloud-messaging/topic-messaging).
106
-
|topic|String|A single publish/subscribe topic.
107
-
|notificationKey|String|Deprecated. A key that groups multiple registration tokens linked to the same user.
108
-
|registrationIds|String[]|Deprecated. Use registrationTokens instead.|
109
-
|registrationTokens|String[]|A list of registration tokens. Must contain at least 1 and at most 1000 registration tokens.|
110
-
111
-
If you provide an incorrect recipient key or object type, an `Error` object will be returned to your callback.
101
+
You can send a push notification to various recipient or topic, by providing a notification key, registration token or topic as a string.
102
+
Alternatively, you can send it to several recipients at once, by providing an array of registration tokens.
112
103
113
104
Notice that [you can *at most* send notifications to 1000 registration tokens at a time](https://github.com/ToothlessGear/node-gcm/issues/42).
114
105
This is due to [a restriction](http://developer.android.com/training/cloudsync/gcm.html) on the side of the GCM API.
@@ -161,9 +152,9 @@ var gcm = require("node-gcm")('YOUR_API_KEY_HERE', requestOptions);
161
152
// Prepare a GCM message...
162
153
163
154
// Send it to GCM endpoint with modified request options
164
-
gcm.send(message, { registrationTokens:regTokens }, function (err, response) {
155
+
gcm.send(message, regTokens, function (err, response) {
0 commit comments