Until recently, creating desktop-like applications in the browser meant using inefficient Ajax or Comet technologies to communicate with the server. With this practical guide, you’ll learn how to use WebSocket, a protocol that enables the client and server to communicate with each other on a single connection simultaneously . No more asynchronous communication or long polling! For developers with a good grasp of JavaScript (and perhaps Node.js), author Andrew Lombardi provides useful hands-on examples throughout the book to help you get up to speed with the WebSocket API. You’ll also learn how to use WebSocket with Transport Layer Security (TLS).
Andrew Lombardi is a veteran entrepreneur and software developer. His parents taught him to code while barely able to read on an Apple // he still wishes he had. He invented the Internet and Nutella (suck it Al Gore) while drinking bulletproof coffee and staring off into space. He’s been running the consulting firm Mystic Coders for 18 years, authored a kick-ass book for O'Reilly on WebSocket, coding, speaking internationally and offering technical guidance to companies as large as Walmart and companies with problems as interesting as helicopter simulation. He firmly believes that the best thing he’s done so far, is being a great dad.
Websocket: Lightweight Client-Server Communications is a very interesting piece.
Let me start by saying that this is the 3rd O'Reilly book that I've read recently (in the past two months) and I've been left very disappointed by the overall quality of the writing and code examples.
The first two chapters are high-level information about the WebSocket protocol and WebSocket API, nothing fancy but it's definitely concise and easy to understand. No complaints there.
And Chapter 3 and forth is where the code examples start to be more frequent. The book drops greatly in quality and makes me spend 15 minutes at each code example trying to figure out how to connect the pieces and make a working prototype.
The author throws away here and there code scraps telling you that you should now open a browser and see that it works. Wait, Andrew! You almost always forget to provide a working client or server code.
Needless to say it's a great waste of time that you have to dig through the book 'official' book source code and re-read 2-3 times each code example page to get it all together and working. Always ahead of the current chapter progress, since there are many places that leave you without anything working and trying to convince you that you actually have something. N O P E.
Moving on, the RabbitMQ and Vagrant short part was nice. It sparkled my interest in RabbitMQ and I would definitely read a whole book about RabbitMQ.
Chapter 5 - WebSocket Compatibility is mostly useless in terms of original content. It's rewrites of the chat you wrote in earlier chapters and content that you'll be better of reading in the official libraries documentation where it would always be up-to-date and more informative. It's completely fine to skip this chapter.
Now the WebSocket Security chapter is probably the best one in the whole book and the one really worth reading. You won't find all the information compact in one place anywhere else.
And for the code examples I'll dedicate a whole star. How the hell do these code examples ever get approved and print published in the book? They're written absolutely terrible. No good practices followed. Not even consistency in the coding style. It's like the code was written by three people that had no agreement on how they'll write the code. What is this, a school work? Get your grip together and rewrite at least the code in the Github repo into something readable by JS software developers.
If I compare my review with the reviews in Amazon.com, it would look like the amazon reviewers are either paid, haven't read the book thoroughly following each chapter or haven't read beyond Chapter 2.
For a web programmer, the promise of real-time communication with your web server sounds fantastic. Over the years I have done some research on this here and there, and usually been quickly thwarted. The WebSocket technology seems to put these things into reach. However, a quick search on Amazon for WebSocket books seems to indicate that nobody is that happy with the books that are out there.
I just finished Andrew Lombardi's book on the topic and I am mildly pleased. The thing that would have made this a five start book would have been to take his page 123 (the next to last page of the book) where he mentions "Alternate Server Implementations" into the rest of the book. The nodeJS examples he gives in this book are helpful, but there are a lot of us to operate in other languages/frameworks. I understand the basics of websocket now, but I still can't use it.