Introducing Socket.IO

Socket.IO is a mature and well-established library with excellent cross-browser support. It aims to quickly and reliably establish a bidirectional communication channel in a cross-browser compatible way. It provides a consistent abstraction, based on idiomatic JavaScript events, for real-time communication between the client and the server over this channel. If you have ever used SignalR in .NET, you can think of Socket.IO as the JavaScript equivalent.

Implementing a chat room with Socket.IO

Let's implement a chat lobby for users of our application to talk to one another. First, we need to install Socket.IO:

> npm install --save socket.io

The server-side implementation for this is very simple. We just need to tell Socket.IO ...

Get Learning Node.js for .NET Developers now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.