Skip to main content

Livelink

Defined in: livelink.js/sources/Livelink.ts:93

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.

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",
});

Examples

DocumentDescription
Complete Example-

Other

NameDescription
sessionThe session associated with this Livelink instance.
sceneThe scene the current session is running.
default_decoded_frame_consumer-
activity_watcher-
latency-
viewports-
devices-
TO_REMOVE__setReadyCallback-
TO_REMOVE__startIfReady-
startStart a new session on the specified scene.
join_or_startTry to join an existing session on the specified scene, if none is found fallback to starting a new one.
joinJoin an existing session.
disconnectDisconnect from the server and release all local resources.
addViewportsAdd viewports to the remote rendering surface.
removeViewportRemove viewports from the remote rendering surface.
configureRemoteServerConfigure the remote server with the desired codec.
isConfiguredCheck if the client is configured.
setEncodedFrameConsumerSet the encoded frame consumer.
startStreamingStart streaming the viewports from the server.
startSimulationSend a script event to the server to start the simulation.
pauseSimulationSend a script event to the server to pause the simulation.
stopSimulationSend a script event to the server to stop the simulation.
sendSkeletonPoseSend a partial skeleton pose targeting a specific animation controller.
configureHeadlessClient-

Other

session

readonly session: Session;

Defined in: livelink.js/sources/Livelink.ts:245

The session associated with this Livelink instance.


scene

readonly scene: Scene;

Defined in: livelink.js/sources/Livelink.ts:250

The scene the current session is running.


default_decoded_frame_consumer

Get Signature

get default_decoded_frame_consumer(): DecodedFrameConsumer

Defined in: livelink.js/sources/Livelink.ts:303

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


activity_watcher

Get Signature

get activity_watcher(): ActivityWatcher

Defined in: livelink.js/sources/Livelink.ts:311

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

Returns

ActivityWatcher


latency

Get Signature

get latency(): number

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

The latency of the connection in milliseconds.

Returns

number


viewports

Get Signature

get viewports(): Viewport[]

Defined in: livelink.js/sources/Livelink.ts:325

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

Returns

Viewport[]


devices

Get Signature

get devices(): Readonly<{
mouse: Mouse;
keyboard: Keyboard;
gamepad: Gamepad;
}>

Defined in: livelink.js/sources/Livelink.ts:503

Experimental

Returns

Readonly<{ mouse: Mouse; keyboard: Keyboard; gamepad: Gamepad; }>


TO_REMOVE__setReadyCallback()

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

Defined in: livelink.js/sources/Livelink.ts:108

Parameters

ParameterType
callback() => void

Returns

void

Deprecated


TO_REMOVE__startIfReady()

TO_REMOVE__startIfReady(): void

Defined in: livelink.js/sources/Livelink.ts:115

Returns

void

Deprecated


start()

static start(params: {
scene_id: UUID;
token: string;
is_transient: boolean;
}): Promise<Livelink>

Defined in: livelink.js/sources/Livelink.ts:154

Start a new session on the specified scene.

Parameters

ParameterTypeDescription
params{ scene_id: UUID; token: string; is_transient: boolean; }
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.

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[];
}) => null | SessionInfo;
is_transient: boolean;
}): Promise<Livelink>

Defined in: livelink.js/sources/Livelink.ts:186

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[]; }) => null | SessionInfo; is_transient: boolean; }
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[]; }) => null | SessionInfoA 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.

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;
}): Promise<Livelink>

Defined in: livelink.js/sources/Livelink.ts:235

Join an existing session.

Parameters

ParameterTypeDescription
params{ session: Session; }
params.sessionSessionThe session to join

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.js/sources/Livelink.ts:349

Disconnect from the server and release all local resources.

Note that the session is not closed, it can be reconnected later.

Returns

Promise<void>


addViewports()

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

Defined in: livelink.js/sources/Livelink.ts:377

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.js/sources/Livelink.ts:388

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.js/sources/Livelink.ts:403

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.js/sources/Livelink.ts:424

Check if the client is configured.

Returns

boolean


setEncodedFrameConsumer()

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

Defined in: livelink.js/sources/Livelink.ts:431

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.js/sources/Livelink.ts:449

Start streaming the viewports from the server.

Returns

void


startSimulation()

startSimulation(): void

Defined in: livelink.js/sources/Livelink.ts:462

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

Returns

void


pauseSimulation()

pauseSimulation(): void

Defined in: livelink.js/sources/Livelink.ts:469

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

Returns

void


stopSimulation()

stopSimulation(): void

Defined in: livelink.js/sources/Livelink.ts:476

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

Returns

void


sendSkeletonPose()

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

Defined in: livelink.js/sources/Livelink.ts:487

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


configureHeadlessClient()

configureHeadlessClient(): Promise<ClientConfigResponse>

Defined in: livelink.js/sources/Livelink.ts:514

Experimental

Returns

Promise<ClientConfigResponse>