Current state of Node.js WebSocket modules

Kommentare

I need a WebSocket server module for Node.js that supports draft-76 of the WebSocket protocol, which is used by iOS clients and the web-socket-js Flash fallback library, e.g. in Internet Explorer and hybi-10 (and later hybi-16, which is considered final), used by modern browsers like Firefox, Chrome).

The library should not wrap the protocol nor need a special client library, but speak standard WebSocket (i.e. I’m responsible for all fallback options like XHR polling, etc.).

There are some modules, but none of them satisfies all requirements:

node-websocket-server (miksago)

  • Supports draft-75-76
  • Does not work with HAProxy (Issue #29)
  • Needs some workarounds to avoid connection leaks (Issue #79)
  • Otherwise seems fast and stable

WebSocket-Node (Worlize)

  • Supports hybi-08-10 (protocol version 8)
  • The code looks nice and clean, well documented

Socket.IO (learnboost)

  • Supports draft-75-76, hybi-07-12 (protocol 8), hybi-16 (protocol 13)
  • Works with HAProxy
  • Needs special client library, no pure WebSocket server (non-trivial wrapping protocol with HTTP handshake, etc.)
  • Has some issues with reconnecting (Issue #269)

SockJS (sockjs)

  • Supports draft-76, hybi-10 (protocol 7, 8)
  • Needs special client library, no pure WebSocket server

Miksago is working on a generic WebSocket protocol implementation for all protocols (node-websocket-protocol) that can be integrated in any project or library. But the interface is not finished yet and work on the library has not been started (see nws Issue #72).

em-websocket for Ruby seems to be a quite complete and stable implementation for all protocols… Maybe I should take a month off and port it to Node.js… (just kidding)