webstation-broker
DeveloperPython referenceroom

room._RoomReader

Reads a room socket until its outbox gives up on the recipient.

Reads a room socket until its outbox gives up on the recipient.

The first receive() binds the reader to the task calling it and starts one watcher, which interrupts that task if it is parked in receive() when the outbox gives up; otherwise the next read sees it.

Functions

func__init__(self, websocket, abandoned) -> None

Prepare to read websocket.

paramself
paramwebsocketWebSocket

The room socket to read from.

paramabandonedasyncio.Event

Set once the connection should no longer be served.

Returns

None
func_watch(self, handler) -> None

Cancel the handler's pending read once the outbox gives up.

paramself
paramhandlerasyncio.Task[Any]

Returns

None
funcreceive(self) -> Optional[Message]

Receive the next message.

Raises

  • RuntimeError: When called from a task other than the first caller's.
paramself

Returns

typing.Optional

The message, or None once the outbox has given up on this socket.

funcclose(self) -> None

Stop watching.

paramself

Returns

None

On this page