Author: Jason Lengstorf & Phil Leggetter
Reviewer: Ian Elliot
What exactly is a realtime web app? Does this book help you understand them in general?
The subtitle of this book is "With HTML5 WebSocket, PHP", and jQuery which gives you a good idea of the sort of thing the book is about. It certainly isn't about WebRTC or any other more "up-market" forms of realtime media and communications. This is essentially about establishing a two-way data exchange between the client and the server.
This is the sort of thing that techniques such as long polling and HTTP streaming were invented to do. If you don't know what these are, don't worry because chapter 1 does a good job of explaining the idea of each of them. It then moves on to consider its proposed solution - WebSockets. The general idea is explained and detail is given down to the protocol used. However, no explanation of using the API is provided.
More importantly the key technology promoted by the book, i.e. WebSockets, is treated in the same fashion. It simply tells you what it is for and then shows you an example program. There's no explanation of the API and how it all works - just one example.
Chapter 3 introduces Pusher, which is a polyfiller library that implements the same sort of features that you get with WebSockets but also has fallbacks to the older technologies when the browser doesn't support the new. This time we have a little more explanation of how to use the API but it is still full of long examples with very little in the way of details. A three-page PHP program, complete with lots of code irrelevant to sending data, is presented before we get a breakdown of how things should be done. You mostly have to learn how to use the API by already knowing.
Part II moves on to the main occupation of the book - building one large example. Chapter 4 goes off target by discussing the native v web apps issue - marketing, sales, features and so on. Chapter 5 is still at the design and management level with a look at what exactly the app should do - Give the App a Mission Statement. Next we are into what makes good markup and then into the idea of MVC and database normalization.
I thought this book was about realtime apps?
You can argue that these are issues that are relevant to realtime apps because they are relevant to all apps - but this is a short book and we haven't had a good explanation of the WebSockets API by this point. The chapter finished with page after page of wireframe designs for the pages we are about to implement.
Part III moves on to creating the app. Chapter 6 is called Designing the App and it considers ... choosing a font. You might find the extended discussion of how to design a form interesting, but I thought I was going to be reading about realtime techniques not how to pick a font.
Chapter 7 is about creating HTML and CSS and presents the markup and CSS that implements the pages we have considered earlier. There is a lot of listing of very basic markup and very little explanation.
Chapters 8 and 9 do get to some code as they are about building the back end. Here you get to build your own MVC framework but again the style is to present you will lots of listings with minimal explanation. This is more like an annotated listing than a book chapter.
Chapter 10 deals with using jQuery to apply animations to the pages and chapter 11 explains Oauth and how to add it to the example application.
At the end of the book you will have learned very little about WebSockets and not much about realtime in general. You will have seen a complete example being built and had lots of rapid explanations of standard technologies such as HTML5.
If you are looking for an introduction to WebSockets and how to use them to build a realtime app you are going to be disappointed in this book. If you want a big example of a complete app then you might get something from reading through, but you are going to have to work quite hard to find the bits that deal with realtime communications among all of the detail concerning the rest of the app's design, implementation and behavior.