I use this library in the description that says I can get the following answers from the server.
GCM response
{ "multicast_id": 216, "success": 3, "failure": 3, "canonical_ids": 1, "results": [ { "message_id": "1:0408" }, { "error": "Unavailable" }, { "error": "InvalidRegistration" }, { "message_id": "1:1516" }, { "message_id": "1:2342", "registration_id": "32" }, { "error": "NotRegistered"} ] } module response
{ "multicast_id": 216, "success_length": 3, "failures_length": 3, "failures": { "NotRegistered": ["42"], "Unavailable": ["8"], "InvalidRegistration": ["15"] }, "canonical_ids_length": 1, "canonical_ids": [ { "message_id": "1:2342", "registration_id": "23", "new_registration_id": "32" } ] } Simple (plain-text response) GCM response
id=1:2342 registration_id=32 module response
{ "id": "1:2342", "registration_id": "32" "old_registration_id": "14" } Question: how can I extract the answer if I send the request in this way
sender.sendMessage(message.toString(), token, false, function(err, data) { if (!err) { console.log(data) } else { console.log(err) } }); and in data , either the { id: '0:1462523393672289]ee2b8a002eefaa' } line is returned to me if the user's token is valid or { NotRegistered } if the user's token is invalid