Skip to content

RelayGroupWriter

Defined in: relay-sdks/ts/src/publish.ts:96

One open group from RelayTrackWriter.openGroup: a single subgroup stream the application writes objects to in order, then FINs with close() or resets with abort(). It holds the track’s write slot until then, so the track’s write() and another openGroup() fail with WRITE_PENDING meanwhile.

readonly closed: boolean;

Defined in: relay-sdks/ts/src/publish.ts:102

True once close() completed, or the group was aborted, failed, or lost its track or connection.


readonly groupId: number;

Defined in: relay-sdks/ts/src/publish.ts:98

The group’s ID. Group IDs start at 0 on each track and increase by one per group the track opens.


readonly objectCount: number;

Defined in: relay-sdks/ts/src/publish.ts:100

How many objects this group has written; the next write() uses it as the object ID.

abort(reason?): void;

Defined in: relay-sdks/ts/src/publish.ts:122

Reset this group and free the track for the next random-access point. After a clean close() this has no effect: the FIN already ended the stream (draft-22 §11.3.2).

Parameter Type
reason? unknown

void


close(): Promise<void>;

Defined in: relay-sdks/ts/src/publish.ts:117

FIN the group within writeTimeoutMs. Resolves once the FIN is handed to the transport, not once the relay acknowledges it. Idempotent after successful completion.

Promise<void>


write(payload, options?): Promise<void>;

Defined in: relay-sdks/ts/src/publish.ts:109

Append one object, starting at ID 0. Each write has its own writeTimeoutMs deadline, and a delivery timeout can end it sooner with DELIVERY_TIMEOUT, which resets the whole group. Properties are encoded as supplied; the relay may transform them before delivery. A 0x02 or 0x06 property on object 0 sets the group’s delivery timeouts; on a later object it is ignored.

Parameter Type
payload ArrayBufferView
options? { properties?: readonly PublishProperty[]; status?: ObjectStatus; }
options.properties? readonly PublishProperty[]
options.status? ObjectStatus

Promise<void>


writeJSON(value, options?): Promise<void>;

Defined in: relay-sdks/ts/src/publish.ts:126

Serialize with JSON.stringify and write one object. Serialization errors leave the writer usable.

Parameter Type
value unknown
options? { properties?: readonly PublishProperty[]; status?: ObjectStatus; }
options.properties? readonly PublishProperty[]
options.status? ObjectStatus

Promise<void>


writeText(text, options?): Promise<void>;

Defined in: relay-sdks/ts/src/publish.ts:124

Encode UTF-8 text and write one object with the same options and semantics as write().

Parameter Type
text string
options? { properties?: readonly PublishProperty[]; status?: ObjectStatus; }
options.properties? readonly PublishProperty[]
options.status? ObjectStatus

Promise<void>