WebSocket provider for Yjs that enables real-time synchronization of Yjs documents over WebSocket connections. Version 3.0.0 requires Yjs ^13.5.6 and Node.js >=16. Published regularly with stable API. Key differentiator: official Yjs WebSocket binding supporting server-side broadcasting and client-side awareness. Lightweight, no additional dependencies beyond yjs. Ideal for collaborative editing applications.
npm install y-websocketNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Creates a Yjs document and connects to a WebSocket server for real-time collaboration.
Use import syntax or dynamic import() in Node.js.
Ensure room name matches /^[a-zA-Z0-9_-]+$/.
Update yjs to ^13.5.6 or later.
Use { doc: yDoc } as option parameter.Implement custom reconnection logic if needed.
Change require() to import statement or use dynamic import().
Use { WebsocketProvider } from 'y-websocket'.Install ws: npm install ws