Event Stream hooks

React hooks for Aeontel event stream.

Hooks

useEventStream websocket

Real-time event stream with automatic React Query cache invalidation.

Opens a WebSocket to the API's event stream for the given workspace. Incoming events are debounced and batch-invalidate the relevant caches so the UI updates in near-real-time.

TypeScript
useEventStream(workspaceId: string | undefined, options: UseEventStreamOptions = {})
TypeScript
// Basic — auto-invalidates all caches
const { connected } = useEventStream("wsp_...");

// With event callback
const { connected } = useEventStream("wsp_...", {
  onEvent: (event) => console.log(event),
  filter: ["run.completed", "agent.*"],
});