Hello
My application will be in Android and IOS. I assume that users from any device can send messages to users of any device, correct? If that’s correct, then if an android device sends a message, does it put Android header, IOS headers or Both ? as I wouldn’t know what device the receiver is on
Background Info:
That being said, I am working on the android app now. My goal is to have a user sends a message to another user (push notification regardless whether the app is open or not). The receiver does not have to engage in an accept/decline like the chat example provided by BackendLess
I read a fair amount of documentation about it and at this point I am not sure of the right way to do things. So I will propose the options I have in mind. Please let me know if one is better (or one I shouldn’t do) or even if there is better option
Options:
1- Documentation says that you don’t have to use the “channel” concept and you can use deliveryOptions.addPushSinglecast( receiver-device-id );
With this option, I have to know the device ID of the receiver. To know this, I can store it as custom property in the Users table when the device registers so I can pull this info. The problem here is that there might be multiple devices for the user and now I have to keep it as an array. Not an issue, but sounds like a headack maintain this list up to date
2- Use the channel publish/subscribe model with filtering. This way All my users will subscribe to the same channel. I will filter the message based on the “intended user Object ID” in the message/header. I don’t like this option as I fear the channel is being overloaded and too much redundant processing is happening
3- This is my preferred option. Use channel publish/subscribe mode where every user subscribe to a specific channel with a name matching his/her userId (or ObjectId from User table). Therefore when a user A need to message User B, User A publish a message to User B Channel. My 2 worries are a) that we could end up with hundreds of thousands of channel (I noticed from docs that this is not an issue) and b) does the app have to be open to receive the message from the channel (I don’t think so)
So I am in favor of option 3 but what’s your take on this? This is the core of the app
Thank you very much