Use of persistence layer in y-websockets

This is more a small question than anything big:

In y-websockets (GitHub - yjs/y-websocket: Websocket Connector for Yjs), the persistence layer is used by setting the env variable like such YPERSISTENCE=./dbDir. However, it is unclear to me why the persistence layer is only working node ./node_modules/y-websocket/bin/server.js and not with the initial call method npx y-websocket-server. Especially, since the y-websocket server binary call is calling the same server.js file internally.

Maybe I’m missing some small detail in between. Thanks for the answers in adavance.

Any comment here for this?

Any help appreciated!

You can also write a custom persistence layer by using setPersistence: y-websocket/utils.js at master · yjs/y-websocket · GitHub

@schlenger you can take a look at this repo to implement persistence with y-websocket server

1 Like