It is time for the next installment of ___ is boss . This time, I want to mention how boss SocketIO is.
There are a few different ways that we typically go about handling real-time (or near real-time) communication between a web browser and server. Depending on how modern the browser is, or what the application demands, some choices are:
- WebSockets - A bidirectional protocol for communicating over a single TCP socket.
- (Long) Polling - the traditional way to accomplish this type of communication, in which the client continually checks the server for updates.
Even where they’re supported problems like unexpected disconnects can make working with them really tricky. Also, having to implement all of them just shouldn’t be something you have to worry about. SocketIO aims to abstract all of that (and more - like the ability to do broadcasts easily) away into a beautiful library.
It works extremely well, and makes this type of communication really fun and easy. A client that absorbs data coming from the server is as quick as: