Skip to content

SubscriptionEvent

type SubscriptionEvent =
| {
type: "subscribed";
value: SubscribeOk;
}
| {
type: "object";
value: MoqtObject;
}
| {
type: "publisherDone";
value: PublishDone;
}
| {
type: "subgroupEnd";
value: {
endOfGroup: boolean;
groupId: number;
subgroupId: number;
};
}
| {
type: "subgroupReset";
value: {
error: unknown;
groupId: number;
};
}
| {
type: "stateNotify";
value: MessageParameters;
}
| {
type: "goaway";
value: Goaway;
}
| {
type: "updateOk";
value: undefined;
};

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

Delivery order is callback arrival order, with no ordering guarantee across streams.

{
type: "subscribed";
value: SubscribeOk;
}
type: "subscribed";

The relay accepted the subscription (SUBSCRIBE_OK).

value: SubscribeOk;

The acceptance info onSubscribed receives.


{
type: "object";
value: MoqtObject;
}
type: "object";

One object arrived, including an object that carries only a protocol status.

value: MoqtObject;

The object; its payload is uninterpreted bytes.


{
type: "publisherDone";
value: PublishDone;
}
type: "publisherDone";

The publisher finished with the track (PUBLISH_DONE). Not an ending: trailing objects can follow.

value: PublishDone;

The done’s status, stream count and reason.


{
type: "subgroupEnd";
value: {
endOfGroup: boolean;
groupId: number;
subgroupId: number;
};
}
type: "subgroupEnd";

A subgroup stream finished cleanly (FIN); only that subgroup ended.

value: object;

Which subgroup ended.

endOfGroup: boolean;

Whether the subgroup’s header marked it as holding the group’s largest object.

groupId: number;

The group the subgroup belongs to.

subgroupId: number;

The subgroup that ended.


{
type: "subgroupReset";
value: {
error: unknown;
groupId: number;
};
}
type: "subgroupReset";

A subgroup stream was reset; objects from it may be missing. Delivery continues.

value: object;

Which group the reset stream carried, and why it failed.

error: unknown;

The transport’s stream error, as the runtime reported it.

groupId: number;

The group the reset subgroup belongs to.


{
type: "stateNotify";
value: MessageParameters;
}
type: "stateNotify";

The publisher changed subscription state on its own (PUBLISH_STATE_NOTIFY).

value: MessageParameters;

Only the parameters that changed.


{
type: "goaway";
value: Goaway;
}
type: "goaway";

The relay sent GOAWAY on this request. Informational; the SDK does not retry.

value: Goaway;

The relay’s suggested new session URI (may be empty) and timeout.


{
type: "updateOk";
value: undefined;
}
type: "updateOk";

The relay acknowledged an update() (REQUEST_OK).

value: undefined;

Always undefined; the acknowledgment carries nothing.