RelaySubscriptionHandlers
Defined in: relay-sdks/ts/src/connect.ts:60
Callbacks for one subscription made through RelaySubscriber.subscribe. Each is optional
and runs synchronously as the protocol layer delivers the event; the SDK adds no queue. The
names say what happened between this connection and the relay. The borrowed
RelaySubscriber.trackSource keeps the core’s protocol names (onOk, onDone) instead.
Methods
Section titled “Methods”onError()?
Section titled “onError()?”onError?(error): void;Defined in: relay-sdks/ts/src/connect.ts:76
The relay answered the request with REQUEST_ERROR: it rejected the subscription, or the request
failed before acceptance (request timeout, or the request stream failing). A REQUEST_ERROR can
also arrive after acceptance, for example when the relay refuses an update(), and it ends the
subscription then too (issue #94). Connection shutdown and GOAWAY never arrive here: a pending
subscription ends through subscribed and ended, and an accepted one surfaces them as
subgroup resets and connection closure.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
error |
RequestError |
Returns
Section titled “Returns”void
onGoaway()?
Section titled “onGoaway()?”onGoaway?(goaway): void;Defined in: relay-sdks/ts/src/connect.ts:116
GOAWAY on this request stream: the relay wants this request re-issued, possibly elsewhere. A
GOAWAY on the connection itself ends the connection instead; observe closed for that.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
goaway |
Goaway |
Returns
Section titled “Returns”void
onObject()?
Section titled “onObject()?”onObject?(object): void;Defined in: relay-sdks/ts/src/connect.ts:78
One object arrived. Payloads are uninterpreted bytes. Objects can arrive after onPublisherDone.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
object |
MoqtObject |
Returns
Section titled “Returns”void
onPublisherDone()?
Section titled “onPublisherDone()?”onPublisherDone?(info): void;Defined in: relay-sdks/ts/src/connect.ts:100
The publisher finished with the track (PUBLISH_DONE). This is a control notification, not the
end of the subscription: objects still in transit can arrive after it, and the request stays
open until cancel() or connection shutdown. The SDK does not resubscribe, and resubscribing
cannot bring back a finished track: against moq-relay, a subscribe after the publisher has gone
is refused (request error 16 unroutable), and one while its namespace stays announced replays
the track’s cached last group and another done one round trip later. Back off, and do not
resubscribe to a track the publisher ended. A done that follows this subscription’s own
update() is different: moq-relay ends the subscription on any update, the track is still live,
and resubscribing is how to apply the change. After a publisher crash the done arrives only at
the relay’s QUIC idle timeout, about 11 s later on moq-relay 0.17.0. See spec/relay-interop.md,
“Publisher restarts”.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
info |
PublishDone |
Returns
Section titled “Returns”void
onStateNotify()?
Section titled “onStateNotify()?”onStateNotify?(parameters): void;Defined in: relay-sdks/ts/src/connect.ts:111
The publisher changed the subscription’s state on its own (PUBLISH_STATE_NOTIFY); parameters
carries only what changed. Informational.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
parameters |
MessageParameters |
Returns
Section titled “Returns”void
onSubgroupEnd()?
Section titled “onSubgroupEnd()?”onSubgroupEnd?(info): void;Defined in: relay-sdks/ts/src/connect.ts:80
A subgroup stream finished cleanly (FIN).
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
info |
{ endOfGroup: boolean; groupId: number; subgroupId: number; } |
info.endOfGroup |
boolean |
info.groupId |
number |
info.subgroupId |
number |
Returns
Section titled “Returns”void
onSubgroupReset()?
Section titled “onSubgroupReset()?”onSubgroupReset?(info): void;Defined in: relay-sdks/ts/src/connect.ts:86
A subgroup stream was reset; objects from it may be missing. Called for every reset the relay forwards. The relay may drop a reset for a subgroup it had not begun forwarding, so an abandoned group can arrive as nothing at all, only a gap in group IDs.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
info |
{ error: unknown; groupId: number; } |
info.error |
unknown |
info.groupId |
number |
Returns
Section titled “Returns”void
onSubscribed()?
Section titled “onSubscribed()?”onSubscribed?(info): void;Defined in: relay-sdks/ts/src/connect.ts:67
The relay accepted the subscription (SUBSCRIBE_OK) and will forward objects. info carries
the track alias, the relay’s parameters (LARGEST_OBJECT when the track already has content),
and the track properties as the relay sends them, which can differ from what the publisher
declared.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
info |
SubscribeOk |
Returns
Section titled “Returns”void
onUpdateOk()?
Section titled “onUpdateOk()?”onUpdateOk?(): void;Defined in: relay-sdks/ts/src/connect.ts:106
The relay acknowledged an update() on this subscription (REQUEST_OK). moq-relay never does: it
ends the subscription with PUBLISH_DONE on any update (spec/behavior.md, relay interop
deviation 4).
Returns
Section titled “Returns”void