We're already familiar with what sockets are. In particular, we know how to establish and manage TCP socket connections using Node, as well as how to pipe data through them bidirectionally or unidirectionally.
The W3C has proposed a socket API that allows browsers to communicate with a socket server over a persistent connection. socket.io is a library that facilitates the establishment of persistent socket connections for those developing with Node, providing both a Node-based socket server and an emulation layer for browsers that do not support the WebSocket API natively.
Let's first take a brief look at how the native WebSocket API is implemented, and how to build a socket server supporting this protocol using Node. We will then build a collaborative drawing application using socket.io with Node.