MCPcopy
hub / github.com/encode/uvicorn / to_message

Method to_message

uvicorn/protocols/websockets/wsproto_impl.py:55–59  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

53 self.length = 0
54
55 def to_message(self) -> WebSocketReceiveEvent:
56 if isinstance(self.value, StringIO):
57 return {"type": "websocket.receive", "text": self.value.getvalue()}
58 assert isinstance(self.value, BytesIO)
59 return {"type": "websocket.receive", "bytes": self.value.getvalue()}
60
61
62class WSProtocol(asyncio.Protocol):

Callers 1

handle_messageMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected