It has 6 chapters and 2 appendices in around 120 pages. This book is made for developers who want to start developing highly interactive and real-time web applications or multiplayer web based video games. The book starts with brief introduction to real-time server side of web applications. How it was and how it is now.
- Going Real-Time on the Web. Covers history of XMLHTTPRequest, AJAX, FlashSocket, etc... and of course introduction to real-time web of today.
- Getting Started with Node.js. Covers brief introduction to Node.js programming. How to install it, how to import npm packages, and how to create a simple "hello world" application.
- Let's Chat. Explains how to start with Socket.IO on the server side but also on the client side. Some basic information what is what on the client/server and how it works.
- Making it More Fun. This chapter is the longest one and I would recommend passing it in 2 or 3 parts with breaks between. It adds nicknames to chat users and "create rooms" functionality.
- The Socket.IO Protocol. Advantages od Socket.IO over WebSockets API. Socket.IO is much more capable and complex, therefore it needs dedicated protocol to function. It also covers all protocol types of messages that exist.
- Deploying and Scaling. Covers some information on how to keep your app on Node.js up and running and how to monitor background processes with Monit and Forever. Scaling with HAProxy, Node Cluster and Redis.
- Appendix A: Socket.IO quick reference.
- Socket.IO Backends. Covers brief information about Socket.Io backends for Erlang, Google Go, Java, Perl and Python.
- The book is made for Socket.IO version 0.9 which is discontinued and no longer available for download over npm. So I downloaded version 1.3.5.
- The protocol API is a bit different from version 0.9 to 1.3.5 so if you get deep into Socket.IO structure you'll be a bit confused.
- The web documentation is kind of poor so you will need to search the web for information how to get valuable data from the Socket.IO Server object.
There were some inconsistencies but all in all it serves its function. I give 4.2/5.
I uploaded the demo chat application on this location:
Its not finished, because I have other things to do at the moment, but it is good start. I used https://www.openshift.com/ with Node.js 0.10 with preinstalled HAProxy load balancer.
If it is unavailable the service sets the app to idle state. So remind me or write an email if it stopped, to restart it.
- Socket.IO creates a room for each tab you have on every browser. So if you have two tabs on Chrome and three tabs in Firefox connected to Socket.IO server, there will be 5 rooms generated for you inside the server state.
- Socket.IO creates unique id for each socket connected to the server and that same id will be for a pregenerated room for the socket. You can create your room with custom name, and the socket you are using will be in two rooms, yours and the pregenerated one.
- Be careful how you connect to namespaces because the internal server state might get mess and you cannot get information properly.
- Socket.IO is easy to code. The API is same on both server and client.It works siemlesly though it is over HTTP layer.