You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is it possible to update the YDoc on the server and broadcast changes to clients? The only way I can see to do this right now would be to connect from the server to itself over Websocket, which feels like a layer of indirection.
I've been able to do something like this, but once I update the YDoc within the room, I'm not sure how to broadcast changes out to the clients. This existing code does not appear to broadcast anything to the clients, even when Y.apply_update is called.
doc=Y.YDoc() # server side doc with changesroom=awaitwebsocket_server.get_room("my-roomname")
remote_doc=room.ydocstate_vector=Y.encode_state_vector(remote_doc)
diff=Y.encode_state_as_update(doc, state_vector)
Y.apply_update(remote_doc, diff)
The text was updated successfully, but these errors were encountered:
It is possible, we do it in Jupyter by watching the file system and e.g. updating a notebook shared model if a file has out-of-band changes. This is modifying the YDoc internally, but connecting to the server through WebSocket like any other peer works too. You should use a WebsocketProvider for that.
BTW, I don't plan to maintain this project (ypy-websocket) anymore, as I've switched from ypy to pycrdt. The equivalent project is pycrdt-websocket.
Thanks for the tip. Can you link to where this is accomplished within Jupyter? I'm trying to modify the YDoc, as in the example above, but I can't seem to get the changes to propagate to the clients.
Is it possible to update the YDoc on the server and broadcast changes to clients? The only way I can see to do this right now would be to connect from the server to itself over Websocket, which feels like a layer of indirection.
I've been able to do something like this, but once I update the YDoc within the room, I'm not sure how to broadcast changes out to the clients. This existing code does not appear to broadcast anything to the clients, even when
Y.apply_update
is called.The text was updated successfully, but these errors were encountered: