Which websocket library to use with Node.js? [closed]

Getting the ball rolling with this community wiki answer. Feel free to edit me with your improvements.

  • ws
    WebSocket server and client for node.js. One of the fastest libraries if not the fastest one.

  • websocket-node
    WebSocket server and client for node.js

  • websocket-driver-node WebSocket server and client protocol parser node.js – used in faye-websocket-node

  • faye-websocket-node WebSocket server and client for node.js – used in faye and sockjs

  • socket.io
    WebSocket server and client for node.js + client for browsers + (v0 has newest to oldest fallbacks, v1 of Socket.io uses engine.io) + channels – used in stack.io. Client library tries to reconnect upon disconnection.

  • sockjs
    WebSocket server and client for node.js and others + client for browsers + newest to oldest fallbacks

  • faye WebSocket server and client for node.js and others + client for browsers + fallbacks + support for other server-side languages

  • deepstream.io clusterable realtime server that handles WebSockets & TCP connections and provides data-sync, pub/sub and request/response

  • socketcluster WebSocket server cluster which makes use of all CPU cores on your machine. For example, if you were to use an xlarge Amazon EC2 instance with 32 cores, you would be able to handle almost 32 times the traffic on a single instance.

  • primus Provides a common API for most of the libraries above for easy switching + stability improvements for all of them.

When to use:

  • use the basic WebSocket servers when you want to use the native WebSocket implementations on the clientside, beware of the browser incompatibilities

  • use the fallback libraries when you care about browser fallbacks

  • use the full featured libraries when you care about channels

  • use primus when you have no idea about what to use, are not in the mood for rewriting your application when you need to switch frameworks because of changing project requirements or need additional connection stability.

Where to test:

Firecamp is a GUI testing environment for SocketIO, WS and all major real-time technology. Debug the real-time events while you’re developing it.

Leave a Comment