Closed floer32 closed 2 years ago
Hi and welcome @hangtwenty !
This should be similar to how other providers work, as described at https://syncedstore.org/docs/sync-providers.
I haven't tried this yet, but when setting up the store, try this:
import { syncedStore, getYjsValue } from "@syncedstore/core";
export const store = syncedStore({ arrayData: [] });
const doc = getYjsValue(store);
const provider = new HocuspocusProvider({
url: 'ws://127.0.0.1:1234',
name: 'example-document',
document: doc,
onAwarenessUpdate: ({ states }) => {
currentStates = states
},
})
Feel free to reopen if you have additional questions! Looking forward to hearing your experience with syncedstore :)
Do you know of a usage example of using SyncedStore with hocuspocus.dev as the server?