Package Exports
- @teamwork/websocket-json-stream
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@teamwork/websocket-json-stream) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
WebSocketJSONStream
A nodejs stream wrapper for WebSocket connections.
Usage
const WebSocket = require('ws')
const WebSocketJSONStream = require('@teamwork/websocket-json-stream')
const stream = new WebSocketJSONStream(new WebSocket(url))
// ...
new WebSocket.Server({ server }).on('connection', ws => {
const stream = new WebSocketJSONStream(ws)
// ...
})See example.js for a working usage example.