MCPcopy
hub / github.com/encode/starlette / receive_bytes

Method receive_bytes

starlette/websockets.py:123–128  ·  starlette/websockets.py::WebSocket.receive_bytes
(self)

Source from the content-addressed store, hash-verified

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

Callers 6

iter_bytesMethod · 0.95
appFunction · 0.95

Calls 2

receiveMethod · 0.95
_raise_on_disconnectMethod · 0.95