Skip to content

SwitchableHandlers

Defined in: relay-sdks/ts/src/switchable.ts:29

Callbacks for a switchable subscription. Each runs synchronously, for the active subscription’s events only, and receives the active track’s name as its last argument. A pending subscription reaches no handler before its cutover.

onError?(error, track): void;

Defined in: relay-sdks/ts/src/switchable.ts:40

The active subscription ended with REQUEST_ERROR: the first one was rejected, or an accepted one was refused later. The switchable has ended. A pending subscription’s rejection rejects its switchTo instead.

Parameter Type
error RequestError
track string

void


onGoaway?(goaway, track): void;

Defined in: relay-sdks/ts/src/switchable.ts:55

GOAWAY on the active subscription’s request stream. Informational; nothing is retried.

Parameter Type
goaway Goaway
track string

void


onObject?(object, track): void;

Defined in: relay-sdks/ts/src/switchable.ts:42

One object from the active subscription. Payloads are uninterpreted bytes.

Parameter Type
object MoqtObject
track string

void


onPublisherDone?(info, track): void;

Defined in: relay-sdks/ts/src/switchable.ts:51

The active track’s publisher finished with it (PUBLISH_DONE). Not an ending, as on RelaySubscriptionHandlers.onPublisherDone; a pending switch carries on.

Parameter Type
info PublishDone
track string

void


onStateNotify?(parameters, track): void;

Defined in: relay-sdks/ts/src/switchable.ts:53

The publisher changed the active subscription’s state (PUBLISH_STATE_NOTIFY).

Parameter Type
parameters MessageParameters
track string

void


onSubgroupEnd?(info, track): void;

Defined in: relay-sdks/ts/src/switchable.ts:44

One of the active subscription’s subgroup streams finished cleanly (FIN).

Parameter Type
info { endOfGroup: boolean; groupId: number; subgroupId: number; }
info.endOfGroup boolean
info.groupId number
info.subgroupId number
track string

void


onSubgroupReset?(info, track): void;

Defined in: relay-sdks/ts/src/switchable.ts:46

One of the active subscription’s subgroup streams was reset; objects from it may be missing.

Parameter Type
info { error: unknown; groupId: number; }
info.error unknown
info.groupId number
track string

void


onSubscribed?(info, track): void;

Defined in: relay-sdks/ts/src/switchable.ts:34

The first subscription accepted (SUBSCRIBE_OK). A later subscription’s acceptance arrives with its cutover, in onSwitched.

Parameter Type
info SubscribeOk
track string

void


onSwitched?(info): void;

Defined in: relay-sdks/ts/src/switchable.ts:60

A cutover: to is now active and from has been cancelled. Runs before the first object of to, which is the one that passed until. Decoders drop state that assumed continuity here.

Parameter Type
info SwitchedInfo

void