Editorials

Web Sockets – What are They Good For?

HTML 5 defines many new features that may be enabled through HTTP. One of the coolest, although, less applicable, is Web Sockets. Web sockets allow a client and server to open and maintain communications over a negotiated pipeline.

You use sockets all the time, maybe without even knowing. When you open up a connection to a database server, the implementation creates communication sockets on top of whatever transport protocol does the delivery. I understand that that is an over-simplification, not totally accurate technically. But it defines the concept. A client requests a communication port with the server, the server grants that port, and maintains a connection back to the client.

You’ve most likely used more sophisticated forms of sockets, or web sockets, if you have used any Instant Messaging program. Instant messaging combines the input from multiple sockets, and re-distributes it to a group of clients. Two people messaging form for sockets. Two client sockets to communicate with the server, and two sockets to retrieve messages from the server. The server input from the clients, and sends the input back to both clients. Of course there can be multiple clients.

Web Sockets, on HTTP extend this communication capability to server and client over the HTTP protocol. This enables sockets to be opened and closed without having to open ports in your firewall, etc.

I have thought it possible that a web application could be written using sockets, should there be a requirement that activity by a user be available to another user. If an application had this kind of ghosting capability, it could make support easier to implement. A help desk client would simply attach to the clients message stream with their own Web Sockets. The concept is kinda spooky. But, there would be no need to have remote sharing, etc. It would be built in at the application level.

There aren’t a lot of applications needing mult-user real time applications. I’m wondering how you, our readers, may have find application? Gaming seems like a logical choice. I’m wondering if there isn’t something more main stream? Perhaps some sort of collaboration application? Drop a note with your thoughts in our comments.

Cheers,

Ben