3 ms·
Wow this is so awesome! How/where does the data get saved for later? I'm guessing from the example, you don't need a database? E.g. I can just save the data to
by yawnxyz 5y ago
Wow this is so awesome!
How/where does the data get saved for later? I'm guessing from the example, you don't need a database? E.g. I can just save the data to a document database, and next time someone works on it, just sync with the database? Or do I not need it at all because it's stored on the browser? And how would the information be associated with accounts, if someone wanted that feature?
Also curious how/where the demo site is deployed (guessing Vercel doesn't work since they don't seem to support websockets? I see that Hocuspocus is mentioned — is that required as a backend to make it all work?
Sorry I'm new to all of this and it sounds like magic, but I'd LOVE to learn how to implement this; especially on something like Vercel, if possible
- hanspagel 5y agoCreator of Hocuspocus [1] (which I’ll open source next year) here. You can use y-websocket [2] aswell. Hocuspocus is a (very nice) wrapper/API around y-websocket written in TypeScript. https://hocuspocus.dev/ https://hocuspocus.dev/ https://github.com/yjs/y-websocket https://github.com/yjs/y-websocket
- YousefED 5y agoThanks! Love the excitement :) SyncedStore supports the same backends as Yjs, here’s an overview: https://syncedstore.org/docs/sync-providers https://syncedstore.org/docs/sync-providers. You can indeed store updates in a centralized database (wrapped with an API to handle auth / accounts) - this is probably the most common scenario. But you can also go fully decentralized and use y-indexeddb to store updates in in the browser, and use a different transport to sync updates between users (e.g. webrtc). —- The cool thing is that the data model behind CRDTs is very flexible in this regard. All changes are captured in small “updates”, and as long as these updates at some point arrive at your device, your document can be updated with the changes (it’s eventually consistent). The site runs on github pages without a backend (examples use y-webrtc).