Quik Framework :: WebSocket Express
- Codename: Berlin
- Version: 0.2.0-beta.76
- License: Check license here
Provides a ws adapter that attaches WebSocket upgrade handling to the active
@quik/http-express HTTP server.
Installation
npm install @quik/websocket-express
Usage
Load @quik/websocket, @quik/http-express, and @quik/websocket-express in
your bootstrap modules and enable the WebSocket server flag:
await setup({
flags: {
startHttpServer: true,
startWebSocketServer: true
},
modules: [
WebSocketModule,
HttpExpressModule,
WebSocketExpressModule
]
});
The adapter listens on websocket.path and uses
QWebSocketHeartbeatService for browser-compatible ping/pong checks.
API Highlights
QExpressWebSocketEnginebinds awsserver to the current HTTP engine and implementsIQWebSocketEngine.engine.send(connectionId, data)writes to one connection; get the active engine withgetWebSocketEngine()from@quik/websocket.engine.broadcast(data)writes to every open connection.
API Reference
Generated API documentation is available in the websocket-express API section.