Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to achieve reliable push message service?

Since I want to build reliable communication in mobile apps, could I get push failed reports(maybe device is offline) from the third party push services (C2DM, APN, urban airship) ? Or We need to build it by ourselves?

like image 858
Jett Hsieh Avatar asked May 24 '12 07:05

Jett Hsieh


People also ask

Are push notifications reliable?

Push notification delivery rates are so unreliable that it makes it virtually impossible to guarantee that a message designed to be read at a specific time – for example, a notification with a promotion for a new sandwich, scheduled to deliver to devices at 1 pm – will reach its destination at that time.


2 Answers

The intended purpose of Android C2DM is to be a battery-saving way for your server app to signal the mobile device that it wants to start reliable communications.

You can structure your message so that each new C2DM encompasses everything that has occurred since the last two-way interaction with the server (i.e., "come and get whatever I've got"). Your failed delivery report is implicit in the mobile device not responding promptly (you can do this because you know C2DM activates your app with an Intent).

Is that really any worse than guaranteed delivery of each message in a lossy medium? Okay, it's worse in that you also have to implement a primary communication method. But you had to do that anyway because C2DM is inbound-only, right?

like image 169
Sparky Avatar answered Sep 18 '22 21:09

Sparky


As Vinay says, MQTT may offer you the feature you desire. When a client connects to the server, it can register a "last will and testament" message with the server. If the client disconnects unexpectedly, the server sends this message to the topic it was instructed to do.

In this scheme, your client could send a message "online" to something like client//status and register the message "offline" as a LWT for the same topic. You could then have a server local client that listened to the topic client/+/status and it would know which clients were online and which offline.

I would suggest that the tokudu demo isn't the best place to look. This blog post by Dale Lane gives insight into using MQTT on Android: http://dalelane.co.uk/blog/?p=1599 and there is a review of MQTT power usage (again on Android) at http://stephendnicholas.com/archives/219

There are client implementations to suit both IOS and Android, see http://mqtt.org/software

like image 21
ralight Avatar answered Sep 17 '22 21:09

ralight