EventStream and SSEEvent types.
Frozen dataclasses for Server-Sent Events. The SSE handler inspects these to format the wire protocol.
realtime.events
| Name | Type | Default | Description |
|---|---|---|---|
type
|
|
— | |
qualified_name
|
|
— | |
element_type
|
|
— | |
description
|
|
— | |
source_file
|
|
— | |
line_number
|
|
— | |
is_autodoc
|
|
— | |
autodoc_element
|
|
— | |
_autodoc_template
|
|
— | |
_autodoc_url_path
|
|
— | |
_autodoc_page_type
|
|
— | |
title
|
|
— | |
doc_content_hash
|
|
— |
Symbols on this page
_SignalUpdate
class
One rendered signal value awaiting client-dialect framing.
SSEEvent
class
A single Server-Sent Event.
EventStream
class
Stream Server-Sent Events to the client.
The generator yields values converted to SSE events:
str: sent as datadict: JSON-serialized as dataFragment: rendered via kida; htmx 2 uses its target as a named channel, while the managed htmx 4 SSE fetch uses unnamed HTML and an<hx-partial>envelope for an explicit DOM targetSSEEvent: sent as-is
Usage::
async def stream():
async for event in bus.subscribe():
yield Fragment("components/item.html", item=event)
return EventStream(stream())
View source · /home/runner/work/chirp/chirp/site/../src/chirp/realtime/events.py:1