Using socket.io, I can listen for a “roomless” connection event on the server and then create a new socket instance that has the relevant room data, e.g.
io.on(‘connection’), socket => {
socket.on(‘join-room’, (roomData) => {
socket.join(roomData);
}
}
But with y-websocket, I can’t seem to figure out how to pass the room data (and the yDoc data) through a y-websocket from the client side to the server before the server knows about the room data. It seems as if my server and my client must both know about the roomData before a y-websocket connection can be established at all.
I suppose I could do a regular POST request to create the y-websocket server instance with the yDoc and the roomData…but this feels more complicated.
Is there some way to listen for a connection on the server without pre-specifying the room data and ydoc?