Skip to content

StreamConfigSchema

const StreamConfigSchema: ZodObject<{ eventTypes: ZodOptional<ZodArray<ZodString, "many">>; protocols: ZodOptional<ZodUnion<[ZodString, ZodArray<ZodString, "many">]>>; reconnect: ZodDefault<ZodBoolean>; reconnectDelay: ZodDefault<ZodNumber>; reconnectMaxAttempts: ZodDefault<ZodNumber>; reconnectMaxDelay: ZodDefault<ZodNumber>; type: ZodEnum<["websocket", "sse"]>; url: ZodOptional<ZodString>; }, "strip", ZodTypeAny, { eventTypes?: string[]; protocols?: string | string[]; reconnect: boolean; reconnectDelay: number; reconnectMaxAttempts: number; reconnectMaxDelay: number; type: "websocket" | "sse"; url?: string; }, { eventTypes?: string[]; protocols?: string | string[]; reconnect?: boolean; reconnectDelay?: number; reconnectMaxAttempts?: number; reconnectMaxDelay?: number; type: "websocket" | "sse"; url?: string; }>

Defined in: packages/core/src/schemas/source.schema.ts:101

WebSocket or Server-Sent Events streaming configuration.

Enables real-time data updates via WebSocket or SSE connections.

Connection Types:

  • websocket - Bidirectional WebSocket connection
  • sse - Server-Sent Events (unidirectional)

WebSocket

stream:
type: websocket
url: "wss://api.example.com/live-data"
reconnect: true
reconnectMaxAttempts: 10
protocols: ["json", "v1"]

Server-Sent Events

stream:
type: sse
url: "https://api.example.com/events"
eventTypes: ["update", "delete"]