The WebSocket API is an advanced technology that makes it possible to open a two-way interactive communication session between the user's browser and a server. We can therefore send messages to a server and receive event-driven responses without having to poll the server for a reply.
- Full documentation for the client-side: https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API
- Npm package for the server-side: https://www.npmjs.com/package/ws
Socket.io is both a Node.js server and a client that connects to network sockets. It uses the WebSocket API but also comes with other things like reliability, auto-reconnection, disconnect detection, binary support, multiplexing and room support.
- Full documentation: https://socket.io/
- Npm package for the server-side: https://www.npmjs.com/package/socket.io