The Ultimate WebSocket server. Ultimate WS is a faster replacement for ws
module, with support for Ultimate Express http upgrades. It uses uWebSockets.js under the hood.
It's useful when:
- You want same API as
ws
module, but the speed ofuWebSockets.js
- You want to convert your Express app with
ws
to use Ultimate Express instead
npm install ultimate-ws
WIP
✅ - Full support (all features and options are supported)
🚧 - Partial support (some features are not supported)
❌ - Not supported
- ✅ WebSocket
- ✅ WebSocket.Server
- ✅ WebSocket.WebSocket
- ✅ WebSocket.WebSocketServer
- ✅ WebSocket.CONNECTING
- ✅ WebSocket.OPEN
- ✅ WebSocket.CLOSING
- ✅ WebSocket.CLOSED
- ❌ WebSocket.createWebSocketStream
- ❌ autoPong
- ❌ allowSynchronousEvents
- ❌ backlog
- ✅ clientTracking
- ❌ handleProtocols
- ❌ host
- ❌ maxPayload
- ❌ noServer
- ✅ path
- ❌ perMessageDeflate
-
- ❌ serverNoContextTakeover
-
- ❌ clientNoContextTakeover
-
- ❌ serverMaxWindowBits
-
- ❌ clientMaxWindowBits
-
- ❌ zlibDeflateOptions
-
- ❌ zlibInflateOptions
-
- ❌ threshold
-
- ❌ concurrencyLimit
- ✅ port
- ✅ server
- ❌ skipUTF8Validation
- ❌ verifyClient
- ❌ WebSocket
- ✅ callback
- ✅ close
- ✅ connection
- ✅ headers
- ✅ listening
- 🚧 error - uWS never throws errors
- 🚧 wsClientError - uWS never throws errors
- ✅ server.address()
- ✅ server.clients
- ✅ server.close(callback)
- ❌ server.handleUpgrade(request, socket, head, callback) - this is unneeded. Just pass
server
(uWS.App or µExpress app) toWebSocketServer
as option. See above for example. - ❌ server.shouldHandle(request)
This category only describes server clients. Client-side (new ws.WebSocket()
) just uses original ws
module, and therefore supports everything.
- ✅ close
- ✅ message
- ✅ ping
- ✅ pong
- ✅ dropped - this event only exists in Ultimate WS for handling dropped messages
- ✅ drain - this event only exists in Ultimate WS for handling backpressure draining
- 🚧 error - uWS never throws errors
- ✅ client.addEventListener(type, listener, options)
- ✅ client.binaryType
- ✅ client.bufferedAmount
- ✅ client.close(code, reason)
- ✅ client.isPaused
- ✅ client.extensions
- ✅ client.onclose
- 🚧 client.onerror
- ✅ client.onmessage
- ✅ client.onopen
- ✅ client.pause()
- 🚧 client.ping()
- ❌ client.pong(data, mask, callback)
- ✅ client.protocol
- ✅ client.resume()
- ✅ client.readyState
- ✅ client.removeEventListener(type, listener)
- 🚧 client.send(data, options, callback) - returns 1 for success, 2 for dropped due to backpressure limit, 0 for built up backpressure that will drain over time. Callback will only get error if it returns 2.
-
- ✅ options.binary
-
- ✅ options.compress
-
- ❌ options.fin
-
- ❌ options.mask
- ✅ client.terminate()