EventSourceResponse
Streaming response with text/event-stream media type.
Attributes
| Attribute | Type | Description |
|---|---|---|
| media_type | string = text/event-stream | The HTTP Content-Type header value used to identify the response as a Server-Sent Events stream. |
Constructor
Signature
def EventSourceResponse() - > null
Signature
def EventSourceResponse(
content: Any,
status_code: int = 200,
headers: dict = null,
media_type: str = text/event-stream,
background: BackgroundTask = null
) - > null
Parameters
| Name | Type | Description |
|---|---|---|
| content | Any | The iterable or generator yielding the event stream data |
| status_code | int = 200 | The HTTP status code for the response |
| headers | dict = null | A dictionary of HTTP headers to include in the response |
| media_type | str = text/event-stream | The mime type for the response, defaulting to the SSE standard |
| background | BackgroundTask = null | A background task to run after the response has been sent |