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.
Properties
Section titled “Properties”closed
Section titled “closed”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.
groupId
Section titled “groupId”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.
objectCount
Section titled “objectCount”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.
Methods
Section titled “Methods”abort()
Section titled “abort()”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).
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
reason? |
unknown |
Returns
Section titled “Returns”void
close()
Section titled “close()”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.
Returns
Section titled “Returns”Promise<void>
write()
Section titled “write()”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.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
payload |
ArrayBufferView |
options? |
{ properties?: readonly PublishProperty[]; status?: ObjectStatus; } |
options.properties? |
readonly PublishProperty[] |
options.status? |
ObjectStatus |
Returns
Section titled “Returns”Promise<void>
writeJSON()
Section titled “writeJSON()”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.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
value |
unknown |
options? |
{ properties?: readonly PublishProperty[]; status?: ObjectStatus; } |
options.properties? |
readonly PublishProperty[] |
options.status? |
ObjectStatus |
Returns
Section titled “Returns”Promise<void>
writeText()
Section titled “writeText()”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().
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
text |
string |
options? |
{ properties?: readonly PublishProperty[]; status?: ObjectStatus; } |
options.properties? |
readonly PublishProperty[] |
options.status? |
ObjectStatus |
Returns
Section titled “Returns”Promise<void>