I've been developing a chat app with Titanium and I'm facing some issues while sending push notifications when a user send a message.
If I simply call:
Cloud.PushNotifications.notify({
channel : 'myChannel',
to_ids : usersID.toString(),
payload : {
message : "message",
from : myId,
sound : "default",
alert : "New message!",
}
};, function(e) {
if (e.success) {
console.log('Success');
} else {
console.log('Error:\n' + ((e.error && e.message) || JSON.stringify(e)));
}
});
I get the OK from the server
{"push_notification":{"id": "xxx", "payload": "{\"message\":\"message\",\"from\":\"xxx\",\"sound\":\"default\",\"alert\":\"New message!\"}", "channel": "myChannel"}, "success": true,"error": false, "meta":{"code": 200, "status": "ok", "method_name": "Notify"}}
but the push notification is marked with the status Failure on the ArrowDB panel.
A different story if I set to_ids = "everyone"
, the push is sent (as long as you're an admin user).
The weird thing is that I get the same error if I try to send it from the ArrowDB panel.
Sending the push with specific IDs
I'm not sure what I'm doing wrong but I tried to stick to the basic examples provided by titanium.