Skip to main content

Class: Livelink

Defined in: livelink.clients/livelink.js/sources/Livelink.ts:87

This class represents the Livelink connection between the client and the 3dverse server holding the session. It holds access to the actual socket connection as well as a client local representation of the rendered scene.

This class is not directly instantiable, you need to use the provided static functions to create an instance:

Connection lifecycle

The connection lifecycle is as follows:

Input devices

Input devices can be accessed from the Livelink instance using the Livelink.devices property. They can be activated and deactivated using the appropriate methods. An active input device will automatically send its state as it changes to the server.

Session management

Starting a new session:

const instance = await Livelink.start({
scene_id: "00000000-0000-0000-0000-000000000000",
token: "authentication-token",
});

Joining an existing session:

const session = await Session.find({
scene_id: "00000000-0000-0000-0000-000000000000",
token: "authentication-token",
});
const instance = await Livelink.join({ session });

Joining an existing session or starting a new one if none is found:

const instance = await Livelink.join_or_start({
scene_id: "00000000-0000-0000-0000-000000000000",
token: "authentication-token",
});

Extends

Properties

PropertyModifierTypeDescriptionInherited from
sessionreadonlySessionThe session this instance is connected to.LivelinkBase.session
scenereadonlySceneThe scene the current session is running.LivelinkBase.scene

Accessors

default_decoded_frame_consumer

Get Signature

get default_decoded_frame_consumer(): DecodedFrameConsumer;

Defined in: livelink.clients/livelink.js/sources/Livelink.ts:274

The default internal implementation of the DecodedFrameConsumer interface.

If no custom decoded frame consumer is needed, this can be passed to instanciate EncodedFrameConsumer implementations.

Returns

DecodedFrameConsumer


frame_dt

Get Signature

get frame_dt(): number;

Defined in: livelink.clients/livelink.js/sources/Livelink.ts:281

The delta time in miliseconds between the two latest received frames based on renderer timestamp.

Returns

number


viewports

Get Signature

get viewports(): Viewport[];

Defined in: livelink.clients/livelink.js/sources/Livelink.ts:288

The viewports used to render the scene for the current client.

Returns

Viewport[]


devices

Get Signature

get devices(): Readonly<{
mouse: Mouse;
keyboard: Keyboard;
gamepads_registry: GamepadsRegistry;
}>;

Defined in: livelink.clients/livelink.js/sources/Livelink.ts:435

Experimental

Returns

Readonly<{ mouse: Mouse; keyboard: Keyboard; gamepads_registry: GamepadsRegistry; }>


_api_url

Set Signature

set static _api_url(url: string): void;

Defined in: livelink.clients/livelink.base/sources/LivelinkBase.ts:81

Parameters
ParameterType
urlstring
Returns

void

Inherited from

LivelinkBase._api_url;

activity_watcher

Get Signature

get activity_watcher(): ActivityWatcher;

Defined in: livelink.clients/livelink.base/sources/LivelinkBase.ts:119

The activity watcher disconnects the session if no activity is detected for a certain amount of time.

Returns

ActivityWatcher

Inherited from

LivelinkBase.activity_watcher;

latency

Get Signature

get latency(): number;

Defined in: livelink.clients/livelink.base/sources/LivelinkBase.ts:126

The latency of the connection in milliseconds.

Returns

number

Inherited from

LivelinkBase.latency;

Methods

start()

static start(params: {
scene_id: UUID;
token: string;
is_transient?: boolean;
is_headless?: boolean;
session_options?: Record<string, boolean>;
onProgress?: LivelinkProgressCallback;
}): Promise<Livelink>;

Defined in: livelink.clients/livelink.js/sources/Livelink.ts:103

Start a new session on the specified scene.

Parameters

ParameterTypeDescription
params{ scene_id: UUID; token: string; is_transient?: boolean; is_headless?: boolean; session_options?: Record<string, boolean>; onProgress?: LivelinkProgressCallback; }-
params.scene_idUUIDThe id of the scene to start
params.tokenstringThe public access token or the user token which must have at least read access to the scene
params.is_transient?booleanWhether the session should be transient or not.
params.is_headless?booleanWhether the client should be headless or not.
params.session_options?Record<string, boolean>-
params.onProgress?LivelinkProgressCallbackOptional callback to receive progress updates during connection.

Returns

Promise<Livelink>

A promise to a Livelink instance holding a session with the specified scene

Throws

If the session could not be started


join_or_start()

static join_or_start(params: {
scene_id: UUID;
token: string;
session_selector?: (__namedParameters: {
sessions: SessionInfo[];
}) => SessionInfo | null;
is_transient?: boolean;
is_headless?: boolean;
session_options?: Record<string, boolean>;
onProgress?: LivelinkProgressCallback;
}): Promise<Livelink>;

Defined in: livelink.clients/livelink.js/sources/Livelink.ts:144

Try to join an existing session on the specified scene, if none is found fallback to starting a new one.

Parameters

ParameterTypeDescription
params{ scene_id: UUID; token: string; session_selector?: (__namedParameters: { sessions: SessionInfo[]; }) => SessionInfo | null; is_transient?: boolean; is_headless?: boolean; session_options?: Record<string, boolean>; onProgress?: LivelinkProgressCallback; }-
params.scene_idUUIDThe id of the scene to join
params.tokenstringThe public access token or the user token which must have at least read access to the scene
params.session_selector?(__namedParameters: { sessions: SessionInfo[]; }) => SessionInfo | nullA function to select the session to join among the list of available sessions. If no session is found, the function should return null to fallback to starting a new session.
params.is_transient?booleanWhether the session should be transient or not.
params.is_headless?booleanWhether the client should be headless or not.
params.session_options?Record<string, boolean>-
params.onProgress?LivelinkProgressCallbackOptional callback to receive progress updates during connection.

Returns

Promise<Livelink>

A promise to a Livelink instance holding a session with the specified scene

Throws

If the session could not be joined or started


join()

static join(params: {
session: Session;
is_headless?: boolean;
onProgress?: LivelinkProgressCallback;
}): Promise<Livelink>;

Defined in: livelink.clients/livelink.js/sources/Livelink.ts:207

Join an existing session.

Parameters

ParameterTypeDescription
params{ session: Session; is_headless?: boolean; onProgress?: LivelinkProgressCallback; }-
params.sessionSessionThe session to join
params.is_headless?booleanWhether the client should be headless or not.
params.onProgress?LivelinkProgressCallbackOptional callback to receive progress updates during connection.

Returns

Promise<Livelink>

A promise to a Livelink instance holding the specified session

Throws

If the session could not be joined


disconnect()

disconnect(): Promise<void>;

Defined in: livelink.clients/livelink.js/sources/Livelink.ts:318

Disconnect from the server and release all local resources.

Note that the session is not closed, it can be reconnected later. Safe to call multiple times.

Returns

Promise<void>

Overrides

LivelinkBase.disconnect;

addViewports()

addViewports(params: {
viewports: Viewport[];
}): void;

Defined in: livelink.clients/livelink.js/sources/Livelink.ts:341

Add viewports to the remote rendering surface.

Parameters

ParameterTypeDescription
params{ viewports: Viewport[]; }-
params.viewportsViewport[]The viewports to add.

Returns

void


removeViewport()

removeViewport(params: {
viewport: Viewport;
}): void;

Defined in: livelink.clients/livelink.js/sources/Livelink.ts:352

Remove viewports from the remote rendering surface.

Parameters

ParameterTypeDescription
params{ viewport: Viewport; }-
params.viewportViewportThe viewport to remove.

Returns

void


configureRemoteServer()

configureRemoteServer(params: {
codec?: CodecType;
}): Promise<ClientConfigResponse>;

Defined in: livelink.clients/livelink.js/sources/Livelink.ts:367

Configure the remote server with the desired codec.

The viewports must have been added using Livelink.addViewports before calling this method.

Parameters

ParameterTypeDescription
params{ codec?: CodecType; }-
params.codec?CodecTypeThe codec to use for encoding the frames.

Returns

Promise<ClientConfigResponse>

A promise to the client configuration response.


isConfigured()

isConfigured(): boolean;

Defined in: livelink.clients/livelink.js/sources/Livelink.ts:388

Check if the client is configured.

Returns

boolean


setEncodedFrameConsumer()

setEncodedFrameConsumer(__namedParameters: {
encoded_frame_consumer: EncodedFrameConsumer;
}): Promise<void>;

Defined in: livelink.clients/livelink.js/sources/Livelink.ts:395

Set the encoded frame consumer.

Parameters

ParameterType
__namedParameters{ encoded_frame_consumer: EncodedFrameConsumer; }
__namedParameters.encoded_frame_consumerEncodedFrameConsumer

Returns

Promise<void>


startStreaming()

startStreaming(): void;

Defined in: livelink.clients/livelink.js/sources/Livelink.ts:413

Start streaming the viewports from the server.

Returns

void


startHeadlessClient()

startHeadlessClient(): Promise<void>;

Defined in: livelink.clients/livelink.js/sources/Livelink.ts:446

Experimental

Returns

Promise<void>


TO_REMOVE__setReadyCallback()

TO_REMOVE__setReadyCallback(callback: () => void): void;

Defined in: livelink.clients/livelink.js/sources/Livelink.ts:631

Parameters

ParameterType
callback() => void

Returns

void

Deprecated


TO_REMOVE__startIfReady()

TO_REMOVE__startIfReady(): void;

Defined in: livelink.clients/livelink.js/sources/Livelink.ts:638

Returns

void

Deprecated


startSimulation()

startSimulation(): void;

Defined in: livelink.clients/livelink.base/sources/LivelinkBase.ts:206

Send a script event to the server to start the simulation.

Returns

void

Inherited from

LivelinkBase.startSimulation;

pauseSimulation()

pauseSimulation(): void;

Defined in: livelink.clients/livelink.base/sources/LivelinkBase.ts:213

Send a script event to the server to pause the simulation.

Returns

void

Inherited from

LivelinkBase.pauseSimulation;

stopSimulation()

stopSimulation(): void;

Defined in: livelink.clients/livelink.base/sources/LivelinkBase.ts:220

Send a script event to the server to stop the simulation.

Returns

void

Inherited from

LivelinkBase.stopSimulation;

sendSkeletonPose()

sendSkeletonPose(params: {
controller: Entity;
partial_pose: SkeletonPartialPose;
}): void;

Defined in: livelink.clients/livelink.base/sources/LivelinkBase.ts:231

Send a partial skeleton pose targeting a specific animation controller.

Parameters

ParameterTypeDescription
params{ controller: Entity; partial_pose: SkeletonPartialPose; }-
params.controllerEntityThe entity having the animation controller component.
params.partial_poseSkeletonPartialPoseThe partial pose to send.

Returns

void

Inherited from

LivelinkBase.sendSkeletonPose;