(self)
| 121 | return cast(str, message["text"]) |
| 122 | |
| 123 | async def receive_bytes(self) -> bytes: |
| 124 | if self.application_state != WebSocketState.CONNECTED: |
| 125 | raise RuntimeError('WebSocket is not connected. Need to call "accept" first.') |
| 126 | message = await self.receive() |
| 127 | self._raise_on_disconnect(message) |
| 128 | return cast(bytes, message["bytes"]) |
| 129 | |
| 130 | async def receive_json(self, mode: str = "text") -> Any: |
| 131 | if mode not in {"text", "binary"}: |