INNER CODE UNIT · Python

_wait_for_websocket_disconnect

ok-oldking/ok-script · ok/ui/web/app.py:124

async def _wait_for_websocket_disconnect(websocket):
    """Consume inbound frames so ASGI can deliver an idle client's disconnect."""
    while True:
        message = await websocket.receive()
        if message.get("type") == "websocket.disconnect":
            return


class _ExitWake:
    """Adapt the core ExitEvent stop protocol to an event-loop callback."""

    def __init__(self, wake):
        self.wake = wake

    def stop(self):
        self.wake()

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…