@liveflux/ws
v0.1.0
Published
Generic WebSocket adapter for Liveflux — works with any backend that exposes a plain WebSocket, in any language.
Maintainers
Readme
@liveflux/ws
The generic WebSocket adapter for Liveflux — works with any backend
that exposes a plain WebSocket, in any language. Turns a raw socket into a normalized, reconnect-safe
event stream for @liveflux/core.
- Backend-agnostic. No wire-protocol assumptions — bring your own
encode/decode. - Zero runtime dependencies, tree-shakeable, tiny.
- Reconnect-safe. The active subscription set is re-sent on every reopen.
- Configurable & secure by default. Injectable
WebSocket, outbound backpressure, and an inbound message-size guard.
Install
pnpm add @liveflux/ws @liveflux/core@liveflux/core is a peer dependency.
Usage
import { LivefluxClient } from '@liveflux/core';
import { ws } from '@liveflux/ws';
const client = new LivefluxClient({
adapter: ws('wss://api.example.com/socket'),
});In Node (or tests) where there is no global WebSocket, inject one:
import WebSocket from 'ws';
ws('wss://api.example.com/socket', { WebSocket });See the full documentation at liveflux.bpdm.dev.
License
MIT © Bhavin Devamorari
