Skip to content

The Ultimate WebSocket server. ws-compatible server, based on uWebSockets.

Notifications You must be signed in to change notification settings

whirlwindnoa/ultimate-ws

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

46 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ultimate WS

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 of uWebSockets.js
  • You want to convert your Express app with ws to use Ultimate Express instead

npm install ultimate-ws

Compatibility

WIP

✅ - Full support (all features and options are supported)
🚧 - Partial support (some features are not supported)
❌ - Not supported

WebSocket

  • ✅ WebSocket
  • ✅ WebSocket.Server
  • ✅ WebSocket.WebSocket
  • ✅ WebSocket.WebSocketServer
  • ✅ WebSocket.CONNECTING
  • ✅ WebSocket.OPEN
  • ✅ WebSocket.CLOSING
  • ✅ WebSocket.CLOSED
  • ❌ WebSocket.createWebSocketStream

Server

Server options

  • ❌ autoPong
  • ❌ allowSynchronousEvents
  • ❌ backlog
  • ✅ clientTracking
  • ❌ handleProtocols
  • ❌ host
  • ❌ maxPayload
  • ❌ noServer
  • ✅ path
  • ❌ perMessageDeflate
    • ❌ serverNoContextTakeover
    • ❌ clientNoContextTakeover
    • ❌ serverMaxWindowBits
    • ❌ clientMaxWindowBits
    • ❌ zlibDeflateOptions
    • ❌ zlibInflateOptions
    • ❌ threshold
    • ❌ concurrencyLimit
  • ✅ port
  • ✅ server
  • ❌ skipUTF8Validation
  • ❌ verifyClient
  • ❌ WebSocket
  • ✅ callback

Server events

  • ✅ close
  • ✅ connection
  • ✅ headers
  • ✅ listening
  • 🚧 error - uWS never throws errors
  • 🚧 wsClientError - uWS never throws errors

Server properties

  • ✅ server.address()
  • ✅ server.clients
  • ✅ server.close(callback)
  • ❌ server.handleUpgrade(request, socket, head, callback) - this is unneeded. Just pass server (uWS.App or µExpress app) to WebSocketServer as option. See above for example.
  • ❌ server.shouldHandle(request)

Client

This category only describes server clients. Client-side (new ws.WebSocket()) just uses original ws module, and therefore supports everything.

Client events

  • ✅ 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 properties

  • ✅ 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()

About

The Ultimate WebSocket server. ws-compatible server, based on uWebSockets.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%