Edinburgh Techmeetup, Web Browsers & the Realtime Web

09 Feb 2012

I gave a presentation yesterday at Edinburgh techmeetup. A big thanks to Dale Harvey for inviting me to talk and to all the attendees for taking the time to attend, listen and interact. Aaron Bassett also gave a good talk on Avoiding Integration Hell so I'd recommend you follow him for more info.

Here's a direct link to the "Web Browsers & the Realtime Web
the past, present & future" slides

And here's the recording of my talk (thanks to Marius Ciocanel):

TechMeetup Talks - Phil @Leggetter on the past present and future of the Realtime web from TechMeetup on Vimeo.

After the presentation there were a number of good questions asked here they are, and my answers. If you've any other questions please drop me an email or leave a comment.

Does WebSockets provide support for common use cases? Does it natively support Pub/Sub?

As with most standardised technology WebSockets offer the very basics of what is required to enable realtime bi-directional communication between a server and a client;

  • var ws = new WebSocket(url) - connect
  • ws.onopen = function() {}; - connected
  • ws.onmessage = function(ev) {}; - some data has arrived
  • ws.send({"some":"data"}); - send some data to the server
  • ws.onclose = function() {}; - the connection has closed
  • ws.close(); - close the connection

If you want functionality like auto reconnection, connection stability checking (ping/pong is hopefully coming), the ability to subscribe to channels/topics/subjects in order to filter and partition data then you need to build this functionality yourself or user a client/server combination that already offers this. We've built this functionality into our Pusher JavaScript library and service.

How do people on shared hosting use this technology?

If you are on a shared hosting then the hosting provide doesn't tend to like this sort of technology because it requires you to maintain persistent connections between the hosting server and the client. I don't know for sure but I think PHP hosting services may do something to stop this sort of thing from working. However, I'm pretty sure that hosting services like Joyent will provide support since socket.io is quite possibly one of the most popular packages available. I could be wrong, but I'd be surprised if I am. If you know, please get in touch.

A great option here is to use Pusher since it remove the need to maintain the persistent connections - it's technology agnostic.

Do WebSockets have problems with proxies and firewalls?

Yes, but connecting over a secure connection (WSS:// over port 443) will work in the majority of cases. For those cases it doesn't work I've seen HTTP Long-Polling and HTTP Streaming also having problems where proxies and firewalls don't like the long-held requests. It's really a battle between realtime technologies and older Internet infrastructure.

Where does SPDY fit into the Realtime Web?

"SPDY is an experimental protocol for a faster web". It's actually used by Google Chrome and a number of Google web apps already (a quick Google suggestions Firefox 11 will support SPDY). The main problem is that in order for this protocol to be used we need the Internet Infrastructure to upgrade. This isn't going to happen to quickly. So, SPDY sounds very promising but it'll be a while until we see it widely adopted/used.

It's easier to move client technology forward (we need IE to auto update), but server technology looks like it'll be slower to move forward.

I recommend keeping an eye on Ilya Grigorik's blog for related tech info.

Please let me know if I've missed any questions (I'm sure I have) or if you have any further questions by [dropping me an email](mailto:[email protected]?subject=Web Browsers & the Realtime Web Qs) or leaving a comment