Skip to content

Gateway

SSE gateway client for real-time events.

class Gateway()

SSE gateway client.

Connects to /api/events and dispatches parsed events to handlers. Handles reconnection with exponential backoff and Last-Event-ID replay.

def on(event: str, handler: Callable[..., Awaitable[None]]) -> None

Register a handler for a specific event type.

async def connect() -> None

Connect to the SSE stream and start dispatching events.

async def disconnect() -> None

Disconnect from the SSE stream.