realtime.events

Page actions AI-ready formats and sharing
Open LLM text
Share with AI
Ask Claude Ask ChatGPT Ask Gemini Ask Copilot

EventStream and SSEEvent types.

Frozen dataclasses for Server-Sent Events. The SSE handler inspects these to format the wire protocol.

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 data
  • dict: JSON-serialized as data
  • Fragment: 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 target
  • SSEEvent: 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