MCPcopy
hub / github.com/benoitc/gunicorn / write_message_async

Method write_message_async

gunicorn/dirty/protocol.py:468–485  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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)

Callers 10

execute_asyncMethod · 0.45
_start_requestMethod · 0.45
route_requestMethod · 0.45
_execute_on_workerMethod · 0.45
handle_status_requestMethod · 0.45
handle_manage_requestMethod · 0.45
handle_stash_requestMethod · 0.45
handle_requestMethod · 0.45

Calls 3

_encode_from_dictMethod · 0.80
writeMethod · 0.45
drainMethod · 0.45

Tested by

no test coverage detected