Oh HTML5 WebSockets, Push Data to my Mobile!

At last a slightly geeky post 😉 ! A few days ago I was at Google Zurich (GTUG) to present a more technical remix of a talk I originally gave at Jazoon 2011.

In a nutshell, the talk was about how HTML5 WebSockets would soon be ready for pushing data to mobile phones in a standard way (and possibly soon to/from any embedded device?). In a Web of Things context, we used this at the MIT Auto-ID labs to push data “directly” from RFID readers to Android or iOS mobile phones within a few lines of Javascript code (for the client) and 20 lines of Java code (for the server).

In this talk I focused on showing the elegance of using WebSockets for Web of Things applications. Indeed, thanks to the very simple Javascript client library, a WebSocket client is summed up as follow:

var myWebSocket = new WebSocket("ws://URL");
myWebSocket.onopen = function(evt) {
alert("Connection open ..."); };
myWebSocket.onmessage = function(evt) {
alert( "Received Message: " + evt.data); };
myWebSocket.onclose = function(evt) {
alert("Connection closed."); };

myWebSocket.send(“Hello Web Sockets!”);

Hard to make it simpler, right? However, the current reality is slightly different. Indeed, as the standard is still evolving, browsers and application/web servers support WebSockets in very different flavours (or just don’t!). Hence, in this talk I was also discussing the use of abstraction frameworks and in particular the impressive Atmosphere framework that deal for you with the current heterogeneous WebSocket support.

However, rather than a lengthy description here, I invite you to watch the talk which was recorded by the great Zurich GTUG crew, enjoy (sorry for the bad-jokes, it was a relaxed event ;-)):

Due to popular demand (I wish :-)) I also posted the sources here.

And the slides are still available on slideshare.

You may also like...