There are two primary classes of WebSocket libraries: those that implement the protocol and leave the rest to the developer and those that build on top of the protocol with various additional features commonly required by realtime messaging applications, such as restoring lost connections, pub/subm and channels, authentication, authorization, etc.
The latter variety often requires that their own libraries be used on the client side, rather than just using the raw WebSocket API provided by the browser. As such, it becomes crucial to make sure you’re happy with how they work and what they’re offering. You may find yourself locked into your chosen solution’s way of doing things once it has been integrated into your architecture, and any issues with reliability, performance, and extensibility may come back to bite you.
Let’s start with a list of those that fall into the first of the two categories.
Note: All of the following are open-source libraries.wsws is a “simple to use, blazing fast and thoroughly tested WebSocket client and server for Node.js”. It is definitely a barebones implementation, designed to do all the hard work of implementing the protocol, however additional features such as connection restoration, pub/sub, and so forth, are concerns you’ll have to manage yourself.
Client (Browser, before bundling):