MQTT and Google Maps

713 views
Skip to first unread message

Sy

unread,
Sep 18, 2011, 5:43:31 AM9/18/11
to MQ Telemetry Transport
Each of our units has a GPS internally and now publishes a message to
the broker containing amongst other things its location, uptime and
status.

I would like to use this data to build a Google map that is updated
automatically giving the location of devices and they're real-time(or
most up-to-date status).

I've been exploring various methods, so far I've ruled out PHP as
unfortunately whilst it is possible to connect to a broker using PHP,
you still need some way to get the information to the client. This
means having the clients 'poll' the server hosting the PHP for
updates.

I am leaning towards using HTML5 with JavaScript using WebSockets, the
API for Google maps is also in JavaScript. One problem is that
WebSockets aren't available in all browsers yet, I'm using Firefox 7.0
amongst others and it currently gives an error message when
encountering the WebSocket object.

I was hoping to open a socket interface to the broker, where the
broker could then push messages to the client.

Is they're any other way of achieving this in a web-browser without
clients putting additional load onto the broker?

Thank you,
Simon
Message has been deleted

Sy

unread,
Sep 18, 2011, 6:26:41 AM9/18/11
to MQ Telemetry Transport
Found this:

http://www.zeitoun.net/articles/comet_and_php/start

Looks very promising, just download the example of this page, copied
to my Apache server and opened two browsers both pointing to:
http://localhost/index.html

The demo contains a text input box and a send button, when I type
anything into the input box it automatically appears in both browsers,
opening more browsers gives the same result. I've check the code and
isn't any polling going on.

Sy

unread,
Sep 18, 2011, 6:30:45 AM9/18/11
to MQ Telemetry Transport
Now I've opened up several browsers all pointing to the same address:

Firefox 7.0
Google Chrome 13.0.782.220
Internet Explorer 9.0.8112.16421
Opera 11.51

All worked perfectly and all updated instantly when the text was
submitted via any of the open windows.
Reply all
Reply to author
Forward
0 new messages