Skip to content

Commit

Permalink
Review
Browse files Browse the repository at this point in the history
  • Loading branch information
davidbrochart committed Nov 16, 2022
1 parent 6cddae8 commit 3d2c3b5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
5 changes: 2 additions & 3 deletions ypy_websocket/websocket_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def ready(self) -> bool:
def ready(self, value: bool) -> None:
self._ready = value
if value:
self.ydoc._ready = True
self.ydoc.ready = True

@property
def on_message(self) -> Optional[Callable]:
Expand Down Expand Up @@ -114,8 +114,7 @@ async def serve(self, websocket):
asyncio.create_task(update(message, room, websocket, self.log))
# forward messages from this client to every other client in the background
for client in [c for c in room.clients if c != websocket]:
self.log.debug("Sending Y update from client with endpoint: %s", websocket.path)
self.log.debug("... to client with endpoint: %s", client.path)
self.log.debug("Sending Y update from client with endpoint %s to client with endpoint: %s", websocket.path, client.path)
asyncio.create_task(client.send(message))
# remove this client
room.clients = [c for c in room.clients if c != websocket]
Expand Down
8 changes: 8 additions & 0 deletions ypy_websocket/ydoc.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,14 @@ def init(self, update_queue: asyncio.Queue):
def begin_transaction(self):
return Transaction(self, self._update_queue, self._ready)

@property
def ready(self) -> bool:
return self._ready

@ready.setter
def ready(self, value: bool) -> None:
self._ready = value


class Transaction:

Expand Down

0 comments on commit 3d2c3b5

Please sign in to comment.