First WebSocket Exercises & Revised Plan

10.19.2015 |

research

This week I started experimenting with WebSocket. The book I am using, WebSocket Essentials, left a lot to be desired. I found that the first examples were vague. The author uses the term, “It’s pretty straight forward” A LOT, even when it’s not. Regardless, here are my notes of the first half of the book and the exercises I did.

Chapter 1

Begins with reviewing what we will and can use with websocket

Chapter 2

Discusses other methods for client server communication like:

Great example of what the difference is: http://www.davesite.com/html5-code-tutorials/html5_interactive_intro_html_5/websockets/

Websockets and its API comes with HTML5. It is not supported by IE9 and earlier. It is implemented on both the client and the server. Server size needs a web sockets library implemented. Node.js can handle this. Web sockets can achieve real time communication. Because of this, it is mostly utilized in real time games web apps. Uses the TCP layer Ready States:

Events

Exercise 1: Echo Test

Echo Test (http://www.websocket.org/echo.html). Send a message and server sends it back. Use Echo server to do it yourself.

Exercise 2: First Node.js Setup / WS

Chapter 3

Begins to get into real-time data transfer. Examples: Chat & online games

Exercise 3: Collaborative Web Presentation

Uses reveal.js to build this application and JS slides library (slides.com). Issue initializing node because reveal.js already has a package.json file. Slides in one window, when moved, move in the other window as well Okay, got the exercise to work. Rest of chapter was a list of this you can do, but not how to do them!

They rest of the book reviews:

I decided to skip to the mobile WebSocket example and work on that.

Since this book has left me wondering, I am going to swap it out for my own lesson plan. This will piece together individual tutorials. It will also have me digging through github repos and breakdown people’s code. The risk is that this code might not be the cleanest, but there is not that much approachable documentation on websocket just yet.

Next week I will have Websockets working on the iPhone & Desktop. It will be changing a color on both screens.

Time Breakdown