Using WebSockets in Node.js

Node.js does not come with a default module for using WebSockets. While we have tried so far to avoid third-party solutions and just show you how to work with Vanilla node, this topic is complex enough to put writing a WebSocket handler from scratch well beyond the scope of the book. Therefore, for the remainder of this chapter, we will use the excellent library. We of course do not imply that this is what you should be using in your own work, and in the Chapter 6, Introducing Ionic, the Going further section at the end of the chapter, we will direct you to alternative solutions and reading materials for WebSockets.

Setting up our project

We will set up a separate project for this chapter, demonstrating how ...

Get Learning Node.js for Mobile Application Development now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.