Monday, December 22, 2014

Finally a Comet style PUSH Framework for Android that Works

There have been a few approaches to Push data frameworks for Android, most notably the endpoints in google cloud. But what if you don't want to hand over your credit card. Or sign up for one of the systems that will hit you with a bill when you grow? For those who don't know COMET was the method of keeping a long request open with keep alives and then using it as a connected socket to push data downstream to a client when new data was available. For mobile users its more tricky with the battery overhead of maintaining the connection, so there are additional reconnect timers added say every 1 or 5 or 10 minutes depending. 


MQTT is a protocol created by IBM and is at alphaworks.

To send a message, a client “publishes” it to the message broker.

The message broker delivers it to the correct client(s).

Publishing a message needs two things.
And a topic.
A client identifies what messages it wants to receive by “subscribing” to a topic.
If another client publishes an update with information about the arrival time of a different flight – our client will not get it.

We will only get messages published – in this case – with updates about flight 1024.

You don’t have to be so specific.

I gave an example of subscribing using wildcards.

Or it could subscribe to receive any flight time updates for Heathrow – arrivals or departures, for any airline, for any flight number.
I think I may have been labouring the idea by this point! :-)

Payload : the data you want to send

For example, recalling the sample topic structure from my last slide, a client can subscribe to get updates about the arrival time of a specific flight flying into Heathrow.

Wildcards are supported – either for a specific level of the topic tree structure, or for a whole subtree.
For example, again referring back to the sample topic structure I showed, a client can subscribe to get updates about the arrival time of any flight for any airline coming into Heathrow
The first “+” is a wildcard for the airline name, and the second “+” is a wildcard for the flight number.

No comments:

Post a Comment