Collaborative list of page names

I have an architecture in which each Y.Doc represents a page, and each of them contains their respective page name.
Now I want to make a list of recent pages for the user, and I want the names on that list to update in realtime if changed. This would be very similar to the main screen of Google Docs.
The only way I found to do this in Yjs is to make a Y.Doc for each page name, containing just that page name, and then bind it to a provider like WebsocketProvider to allow for realtime updates without needing to load the whole page content. The problem is, the number of page names may get big, and in this case each page would need its own Websocket connection. Having 100 Websocket connections just to have the page names update in realtime would be very wasteful of resources I think.

Maybe this can be achieved with subdocuments? But as far as I know, a subdocument (in this case for the page name) can’t be placed in two different Y.Docs (one for the list of recent pages and one for the page contents).
So I’m wondering if there’s a better way to handle this.

Thank you.

1 Like