(self)
| 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 | |
| 62 | class WSProtocol(asyncio.Protocol): |