Interface SSESubscribeHandlers<TDoc, TStart>

Callback handlers for an SSE subscription.

interface SSESubscribeHandlers<TDoc = any, TStart = any> {
    onStart?: (info: TStart) => void;
    onUpdate: (doc: TDoc) => void;
    onError?: (err: Error | Event) => void;
    onClose?: () => void;
}

Type Parameters

  • TDoc = any
  • TStart = any

Properties

onStart?: (info: TStart) => void

Fired once on connect with the relay's startInfo payload.

onUpdate: (doc: TDoc) => void

Fired for every change-stream update.

onError?: (err: Error | Event) => void

Fired on connection error. The connection will not be auto-reopened.

onClose?: () => void

Fired when the connection is closed (either by client or server).