Skip to main content

Type Alias: PlaybackSource

type PlaybackSource =
| string
| Uint8Array
| ArrayBuffer
| unknown[]
| ReadableStream<Uint8Array | string>
| AsyncIterable<Uint8Array | string>
| {
file_path: string;
}
| {
url: string;
init?: RequestInit;
}
| (() => PlaybackSource | Promise<PlaybackSource>);

Defined in: livelink.clients/livelink.agent/sources/data/transports/PlaybackTransport.ts:19

Where a PlaybackTransport reads its recording from.

A recording is a dump of an event stream, not necessarily a file: the same bytes are just as likely to arrive as a string already in memory, an HTTP response, or records the caller parsed itself. Whatever the form, the recorded content is one of three shapes:

  • an MQTT trace dump — lines of <topic> <json>; the topic becomes the event's channel;
  • a JSON array of envelopes{ "channel": "...", "payload": {...}, "timestamp": "..." };
  • a JSON array of bare payloads — no channel information, so every event is replayed on PlaybackTransportConfig.default_channel.

Union Members

string


Uint8Array


ArrayBuffer


unknown[]

Records the caller already parsed: envelopes or bare payloads, skipping JSON.parse.


ReadableStream<Uint8Array | string>


AsyncIterable<Uint8Array | string>


Type Literal

{
file_path: string;
}

A path on the local file system. Node.js only.


Type Literal

{
url: string;
init?: RequestInit;
}

Anything fetch can retrieve. Works in the browser and in Node.js.


Function

() => PlaybackSource | Promise<PlaybackSource>;

Produced on start(), for a source that cannot be built ahead of time.