| 4293 | return message |
| 4294 | |
| 4295 | def send(self, event: ResponsesClientEvent | ResponsesClientEventParam) -> None: |
| 4296 | data = ( |
| 4297 | event.to_json(use_api_names=True, exclude_defaults=True, exclude_unset=True) |
| 4298 | if isinstance(event, BaseModel) |
| 4299 | else json.dumps(maybe_transform(event, ResponsesClientEventParam)) |
| 4300 | ) |
| 4301 | if self._is_reconnecting: |
| 4302 | self._send_queue.enqueue(data) |
| 4303 | return |
| 4304 | try: |
| 4305 | self._connection.send(data) |
| 4306 | except Exception: |
| 4307 | self._send_queue.enqueue(data) |
| 4308 | raise |
| 4309 | |
| 4310 | def send_raw(self, data: bytes | str) -> None: |
| 4311 | if self._is_reconnecting: |