A multiplex-first Yjs WebSocket server and client provider that allows a single physical WebSocket to carry multiple routed Yjs documents under the same namespace. Supports awareness, optional BroadcastChannel sync, optional persistence via callback, and optional NATS cluster sync. The stable version 0.3.0 requires yjs ^13 || ^14 and Node >=16 with npm >=8. Unlike y-websocket which spawns a separate WebSocket per document, this package reuses one connection per namespace, reducing overhead. Ships a bundled CLI for quick start and exports low-level utilities for custom server wiring. Active development.
npm install y-multiplex-websocket-serverNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates creating a Yjs document, attaching it via MultiplexProvider under namespace 'ticket' and docName 'version', and listening for connection status.
Import from exact subpath as shown in documentation.
Always provide a namespace string as second argument to MultiplexProvider constructor.
Use 'npx y-websocket-multiplex-server' instead of older binary name.
Use ES module imports (import) or ensure your project is configured for ESM.
Pass a WebSocket constructor (e.g., from 'ws' package) as opts.WebSocketPolyfill when running in Node.
Ensure NATS_SERVERS env var is correctly set and NATS cluster is running.
import { MultiplexProvider } from 'y-multiplex-websocket-server/multiplex-provider'Use correct subpath import as shown in documentation.
Add opts.WebSocketPolyfill: WebSocket (from 'ws' package) to the MultiplexProvider constructor.
Use server URL like 'ws://localhost:1234/connect/doc'