Displaying all room names

I am using y-websocket with leveldb for persistence, as recommended in the documentation. I am currently using one room per project in my application, and I would like to build some kind of file system to manage it. I’ve searched through the documentation, and have so far turned up empty of ways to retrieve all of the created room names. Is there a way to access the room names through the persistence object, or would I just need to track those externally as created? Would appreciate any advice!

Maybe persistence.getAllDocNames?

I think the real issue I am running into here is that I am unable to access the database outside of the websocket server as it locks it, and there doesn’t seem to be a way to access the persistence object that is generated by the server through the provided websocketProvider object; would you happen to know if there is any workaround to this?

The persistence instance is exported from the server utils, however that is only available on the server-side. You wouldn’t be able to access the server-side persistence object on the client-side, through websocketProvider. All of your changes to the client-side doc will eventually get updated on the websocket server and persisted there though.

I’m not really sure about the lock situation.

If you want to build a “file” system to manage YJS documents, maybe you just need the guids so that you can access the documents as needed. If you had a Y.Map of all guids, you could then do new Y.Doc(guid) to sync with any doc in the system.

A subdocument-based file management system is a different story.

1 Like

Thanks! I’ve figured out a workaround; I pulled down the y-websocket code and I wrapped it in an express.js app which also has GET and POST wrappers for accessing the persistence object from the client.

This is the post I referenced, for anyone interested in solving a similar issue

1 Like