You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This project is intended for learning purposes and demonstration of the Cloudflare Workers and Durable Objects APIs.
If you are looking for a production-ready solution, check out PartyKit which also
supports the Yjs API.
This project implements a Serverless Yjs WebSocket provider using Cloudflare Workers + Durable Objects to relay messages between clients. It is fully compatible with the Yjs WebSocket Connector.
This project uses the Cloudflare Durable Objects WebSocket Hibernation API to terminate WebSocket connections to avoid incurring duration charges when the connection is idle.
It also periodically saves the Yjs document state to a Cloudflare R2 storage bucket and clears the partial updates from the Durable Object storage. The vacuum interval can be configured with the YJS_VACUUM_INTERVAL_IN_MS environment variable. The default is 30 seconds.
Run locally
npm install
npm run dev
This will start a local server using the Wrangler CLI and serve a demo app. You can open a browser
to the URL that is displayed in the console to test it with a simple TipTap
editor.
About
A WebSocket Provider for Yjs running on Cloudflare Workers