Skip to main content

Class: SceneIngestion

Defined in: livelink.clients/livelink.agent/sources/data/SceneIngestion.ts:187

Binds data sources to the scenes an Agent is attached to.

It is the wiring layer, and only that: the mapping work lives in its IngestionPipeline, the attachment policy in its Agent. It binds each ready session's scene to the pipeline, unbinds it when the session goes, and starts the shared sources on the first binding.

It is a EventSink, so any transport — the bundled ones, or your own — can be pointed straight at it, and events can be pushed in by hand with ingest:

const ingestion = new SceneIngestion({
agent: new Agent({ config: { scene_id, token } }),
pipeline: new IngestionPipeline({ mappings, onError }),
sources: [{ kind: "mqtt", config: { broker_url, topics } }],
});
ingestion.addEventListener("on-error", ({ error }) => report(error));
await ingestion.start();

// ...or with no source at all, driven by whatever you like:
await ingestion.ingest({ channel: "devices/42", payload });

await ingestion.stop();

The agent's session-lifecycle events are re-emitted here, so one object is enough to observe the whole thing. An error nobody is listening for falls back to the console rather than vanishing.

Extends​

Implements​

Constructors​

Constructor​

new SceneIngestion(__namedParameters: SceneIngestionOptions): SceneIngestion;

Defined in: livelink.clients/livelink.agent/sources/data/SceneIngestion.ts:261

Parameters​

ParameterType
__namedParametersSceneIngestionOptions

Returns​

SceneIngestion

Throws​

RangeError if ticksPerSecond is neither 0 nor a finite rate in (0, 125].

Overrides​

ObservedEventTarget<SceneIngestionEvents>.constructor

Accessors​

agent​

Get Signature​

get agent(): Agent;

Defined in: livelink.clients/livelink.agent/sources/data/SceneIngestion.ts:277

The underlying agent. Its lifecycle events are re-emitted on this object, so reaching for it is only needed to act on it (join, leave) — not to observe it.

Returns​

Agent


pipeline​

Get Signature​

get pipeline(): IngestionPipeline;

Defined in: livelink.clients/livelink.agent/sources/data/SceneIngestion.ts:284

The mapping engine. Push events straight into it, or read its IngestionStats.

Returns​

IngestionPipeline


stats​

Get Signature​

get stats(): IngestionStats | null;

Defined in: livelink.clients/livelink.agent/sources/data/SceneIngestion.ts:292

What the ingestion has actually done — events in, updates out, and why anything was dropped. null when the pipeline was built with stats: false.

Returns​

IngestionStats | null


boundSessionCount​

Get Signature​

get boundSessionCount(): number;

Defined in: livelink.clients/livelink.agent/sources/data/SceneIngestion.ts:299

The number of sessions currently bound to the pipeline.

Returns​

number

Methods​

addEventListener()​

addEventListener<_EventName>(
event_name: _EventName,
listener: (event: SceneIngestionEvents[_EventName]) => void,
options?: boolean | AddEventListenerOptions): void;

Defined in: livelink.clients/livelink.agent/sources/ObservedEventTarget.ts:34

Register a listener, remembering it so _hasListeners can report on it.

Type Parameters​

Type Parameter
_EventName extends | "on-session-created" | "on-session-joined" | "on-session-ready" | "on-session-left" | "on-error" | "on-stopped" | "on-running" | "on-session-bound" | "on-session-unbound"

Parameters​

ParameterType
event_name_EventName
listener(event: SceneIngestionEvents[_EventName]) => void
options?boolean | AddEventListenerOptions

Returns​

void

Inherited from​

ObservedEventTarget.addEventListener;

removeEventListener()​

removeEventListener<_EventName>(
event_name: _EventName,
listener: (event: SceneIngestionEvents[_EventName]) => void,
options?: boolean | EventListenerOptions): void;

Defined in: livelink.clients/livelink.agent/sources/ObservedEventTarget.ts:73

Remove a listener — the function that was actually registered for it, which for a once listener is the wrapper rather than the listener itself.

Type Parameters​

Type Parameter
_EventName extends | "on-session-created" | "on-session-joined" | "on-session-ready" | "on-session-left" | "on-error" | "on-stopped" | "on-running" | "on-session-bound" | "on-session-unbound"

Parameters​

ParameterType
event_name_EventName
listener(event: SceneIngestionEvents[_EventName]) => void
options?boolean | EventListenerOptions

Returns​

void

Inherited from​

ObservedEventTarget.removeEventListener;

_hasListeners()​

protected _hasListeners<_EventName>(event_name: _EventName): boolean;

Defined in: livelink.clients/livelink.agent/sources/ObservedEventTarget.ts:90

Whether anything is currently listening for an event. Lets an emitter fall back to another channel — a console log for an error nobody observes — instead of dispatching into the void.

Type Parameters​

Type Parameter
_EventName extends | "on-session-created" | "on-session-joined" | "on-session-ready" | "on-session-left" | "on-error" | "on-stopped" | "on-running" | "on-session-bound" | "on-session-unbound"

Parameters​

ParameterType
event_name_EventName

Returns​

boolean

Inherited from​

ObservedEventTarget._hasListeners;

ingest()​

ingest(event: IngestEvent): Promise<void>;

Defined in: livelink.clients/livelink.agent/sources/data/SceneIngestion.ts:310

Push one event through the pipeline, into every bound session's scene.

This is both the EventSink implementation — which is how the configured sources feed it — and the direct entry point for events that come from anywhere else: a webhook, a test, a replay tool, a "send one frame" debug control.

Parameters​

ParameterType
eventIngestEvent

Returns​

Promise<void>

Implementation of​

EventSink.ingest


start()​

start(): Promise<void>;

Defined in: livelink.clients/livelink.agent/sources/data/SceneIngestion.ts:329

Attach the session-lifecycle wiring and start the agent. The sources start lazily on the first ready session.

Returns​

Promise<void>

Throws​

If already started, or if the agent fails to start.


stop()​

stop(): Promise<void>;

Defined in: livelink.clients/livelink.agent/sources/data/SceneIngestion.ts:348

Stop the sources, then stop the agent (leaving all sessions). A no-op when not started.

Returns​

Promise<void>