y-crdt / ypy

Python bindings to y-crdt

Home Page:https://ypy.readthedocs.io/en/latest/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Changes made in a transaction to a YText do not get synced to clients

rpicking opened this issue · comments

I'm currently struggling to update a shared text to update on connected clients. Things seem to work perfectly normal when the changes come via a connected client, but the change to the shared type from the ypy websocket server's shared type are not propagated.

Newly connected clients do get the correct state upon connection, but an sharedType.observe will never be triggered.

The snippet below is how I am updating the YText. When the room is connected I get the text from the yDoc via yText = self.yDoc.get_text('name')

with doc.begin_transaction() as txn:
    yText.insert(txn, 0, 'hello world')

I would expect this to update cause all connected clients in the room's shared type gotten from name to trigger their observe callbacks.

Is this the correct way to update a shared type on the python side? Am I potentially doing something else wrong?