JSPM

@teamwork/websocket-json-stream

1.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 3527
  • Score
    100M100P100Q142463F
  • License MIT

Expose WebSockets with JSON as an object stream

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

NPM module Build Status Coverage Status

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.