format_sse_event
Build SSE wire-format bytes from pre-serialized data.
The result always ends with \n\n (the event terminator).
def format_sse_event(
data_str: str | None = None,
event: str | None = None,
id: str | None = None,
retry: int | None = None,
comment: str | None = None
) - > bytes
Build SSE wire-format bytes from pre-serialized data. The result always ends with \n\n (the event terminator).
Parameters
| Name | Type | Description |
|---|---|---|
| data_str | `str | None` = None |
| event | `str | None` = None |
| id | `str | None` = None |
| retry | `int | None` = None |
| comment | `str | None` = None |
Returns
| Type | Description |
|---|---|
bytes | The UTF-8 encoded byte string formatted according to the Server-Sent Events specification, ready for transmission. |