b2cloud

1st February 2013

Fun with Websockets

Thoughts By 4 years ago

New technology is always fun to play with, even if it is just new to you. So recently I decided to build a mini web application that took advantage of Websockets.

Websocket is a web technology that allows two-way communication between a client browser and a web server. The conventional way to access data on a web server is for the browser to request it. That is to say that the browser needs to keep asking the server for information and once it is available it can retrieve it. Websockets change this by allowing the server to send data to the browser as soon as it is ready. For a more detailed description of Websockets see here.

What does this mean for me? Probably not much at the moment, in the future, an enhanced user experience for web applications. Taking a look at the statistics on Github, code hosting platform, Javascript is by far the most popular programming language, the language of the web browser. Chrome OS is banking on the rise of web applications and so is Mozilla as it moves forward with it’s web based mobile platform, Firefox OS. All of these things point to the rise of rich, interactive real time web applications. Over the coming years it will be interesting to see what will be possible in a browser.

Lets come back from the future for a moment and have a look at what Websockets can do for us now. Here are a couple of interesting example applications that use Websockets. If you have any other sites that you think are interesting let me know.

The examples above just require the user to use one client browser. Multiple users but all using one client. What if this wasn’t the case? What if you had multiple devices all connected to the same web application but performing different tasks? I thought it would be interesting to explore this concept so I built a slide show controller. Here is a simple demo of the concept:

I used reveal.js for the HTML 5 slides and glued it together with the rest of the application. To develop Websocket apps you need a server technology that supports Websockets and a client side library  like socket.io can make things easier. Server side I used  Tornado with Tornadoio2. The mobile site was built using jQuery mobile.

Websockets can be used to push data to client browsers enabling users to interact with web applications from multiple devices at once. Can you see many applications of this concept? Let me know your thoughts and comments on this idea below.

Recommended Posts

Stop butchering the App

Post by 4 years ago

I attended a conference this week with a mix of attendees from government and large corporates.  The amount of times I heard the word App in 4 hours was astounding. But when I asked questions

Connect With Us

We're trusted by some of the largest businesses and enterprises to build digital products that matter.