node-gcm icon indicating copy to clipboard operation
node-gcm copied to clipboard

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

Open hypesystem opened this issue 10 years ago • 1 comments

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" }

hypesystem avatar Feb 23 '15 09:02 hypesystem

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.

eladnava avatar Oct 03 '16 19:10 eladnava