Recipes
Broadcast to all connected clients
import { getWebSocketEngine } from '@quik/websocket';
getWebSocketEngine().broadcast(JSON.stringify({ type: 'price.updated', payload: { symbol: 'ACME', price: 42 } }));
Send to a single connection
import { getWebSocketEngine } from '@quik/websocket';
getWebSocketEngine().send(connectionId, JSON.stringify({ type: 'direct-message', payload: 'Hi there' }));
Change the upgrade path
Set websocket.path (WEBSOCKET_PATH) on @quik/websocket — @quik/websocket-express reads the same key, so no adapter-specific configuration is needed.
Checklist
- Enable both
startHttpServerandstartWebSocketServerbootstrap flags — the adapter needs an active HTTP server to attach the upgrade handler to. - Load
@quik/websocketand@quik/http-expressbefore@quik/websocket-expressin the module list.