ToothlessGear / node-gcm

A NodeJS wrapper library port to send data to Android devices via Google Cloud Messaging
https://github.com/ToothlessGear/node-gcm
Other
1.31k stars 206 forks source link

Make it clear whether or not `message_id` and `registration_id` can be set in a result at the same time #103

Open hypesystem opened 9 years ago

hypesystem commented 9 years ago

I don't know whether they can, but we need to clarify this in the upcoming documentation (#98).

Basically, when a result is returned from Sender#send, can it contain result.results entires that look like this, or are the two fields mutually exclusive (just like error is mutually exclusive with both message_id and registration_id):

{ message_id: "some-id", registration_id: "new-id" }
eladnava commented 7 years ago

It can definitely contain both message_id and registration_id.

message_id: String specifying a unique ID for each successfully processed message. registration_id: Optional string specifying the canonical registration token for the client app that the message was processed and sent to. Sender should use this value as the registration token for future requests. Otherwise, the messages might be rejected. https://developers.google.com/cloud-messaging/http-server-ref#table5

So, registration_id is the updated registration ID for a given device (sometimes GCM updates the registration ID and this is the mechanism to provide the app with the updated ID) and may be returned in addition to message_id, which is the unique ID of the message sent to the device.