Write a message to async stream. Accepts dict format for backwards compatibility. Args: writer: asyncio StreamWriter message: Message dict with 'type', 'id', and payload fields Raises: DirtyProtocolError: If encoding fails
(writer: asyncio.StreamWriter,
message: dict)
| 466 | |
| 467 | @staticmethod |
| 468 | async def write_message_async(writer: asyncio.StreamWriter, |
| 469 | message: dict) -> None: |
| 470 | """ |
| 471 | Write a message to async stream. |
| 472 | |
| 473 | Accepts dict format for backwards compatibility. |
| 474 | |
| 475 | Args: |
| 476 | writer: asyncio StreamWriter |
| 477 | message: Message dict with 'type', 'id', and payload fields |
| 478 | |
| 479 | Raises: |
| 480 | DirtyProtocolError: If encoding fails |
| 481 | ConnectionError: If write fails |
| 482 | """ |
| 483 | data = BinaryProtocol._encode_from_dict(message) |
| 484 | writer.write(data) |
| 485 | await writer.drain() |
| 486 | |
| 487 | # ------------------------------------------------------------------------- |
| 488 | # Sync API (for HTTP workers that may not be async) |
no test coverage detected