Skip to main content

Class: PlaybackTransport

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

Replays a recorded sequence of messages, pacing them from their own timestamps and looping when the sequence ends.

The recording comes from wherever PlaybackSource allows — a file, a URL, a string, a buffer, a stream, an array of records — so the same transport drives a Node.js replay from disk and a browser demo from a bundled dump. Only { file_path } is Node-only.

It buffers the whole recording before replaying it. Looping needs every message to stay in memory, and pacing needs the first timestamp before the second message can be scheduled; a streamed source is therefore drained to completion by start(). This is a replayer, not a reader of live streams — for a genuinely live source, write a Transport that pushes as it reads.

The recorded channel is preserved, so a mapping selecting on channel behaves identically against a live broker and against a dump of that broker — which is the point of replaying in the first place. Only a recording that carries no channel information at all falls back to a constant (PlaybackTransportConfig.default_channel, "playback" by default).

Implements

Constructors

Constructor

new PlaybackTransport(config: {
source: PlaybackSource;
channel_filter?: string;
default_channel?: string;
speed?: number;
loop?: boolean;
}, sink: EventSink): PlaybackTransport;

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

Parameters

ParameterTypeDescription
config{ source: PlaybackSource; channel_filter?: string; default_channel?: string; speed?: number; loop?: boolean; }-
config.sourcePlaybackSourceThe recording to replay.
config.channel_filter?stringOnly replay the messages whose channel matches this MQTT-style pattern (+/* = one segment, trailing # = the rest) — e.g. "uagv/+/+/+/visualization" to replay only the position frames out of a full VDA 5050 trace. Omitted = replay everything.
config.default_channel?stringThe channel given to messages that carry none (a bare-payload recording). Defaults to "playback".
config.speed?numberHow fast to replay, relative to the recorded pace: 1 (the default) replays in real time, 10 replays ten times faster. Only meaningful for a recording that carries timestamps — without them messages are replayed back to back whatever the speed.
config.loop?booleanWhether to start over when the recording ends. Defaults to true.
sinkEventSink-

Returns

PlaybackTransport

Methods

start()

start(): Promise<void>;

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

Read the recording and start replaying its messages.

Returns

Promise<void>

Implementation of

Transport.start


stop()

stop(): Promise<void>;

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

Stop the playback.

Returns

Promise<void>

Implementation of

Transport.stop