Skip to main content

Livelink

@3dverse/livelink v0.8.10


@3dverse/livelink / Livelink

Class: Livelink

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

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 added to the Livelink instance using the Livelink.addInputDevice method. The input devices are responsible for sending periodically their state 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

Other

Other

session

readonly session: Session

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

The session associated with this Livelink instance.


scene

readonly scene: Scene

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

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:302

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:310

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

Returns

ActivityWatcher


viewports

Get Signature

get viewports(): Viewport[]

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

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:497

Experimental

Returns

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


TO_REMOVE__setReadyCallback()

TO_REMOVE__setReadyCallback(callback): void

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

Parameters

callback

() => void

Returns

void

Deprecated


TO_REMOVE__startIfReady()

TO_REMOVE__startIfReady(): void

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

Returns

void

Deprecated


start()

static start(params): Promise<Livelink>

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

Start a new session on the specified scene.

Parameters

params
scene_id

UUID

The id of the scene to start

token

string

The public access token or the user token which must have at least read access to the scene

is_transient

boolean

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

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

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

Parameters

params
scene_id

UUID

The id of the scene to join

token

string

The public access token or the user token which must have at least read access to the scene

session_selector

(__namedParameters) => null | SessionInfo = ...

A 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.

is_transient

boolean

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

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

Join an existing session.

Parameters

params
session

Session

The 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:341

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): void

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

Add viewports to the remote rendering surface.

Parameters

params
viewports

Viewport[]

The viewports to add.

Returns

void


removeViewport()

removeViewport(params): void

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

Remove viewports from the remote rendering surface.

Parameters

params
viewport

Viewport

The viewport to remove.

Returns

void


configureRemoteServer()

configureRemoteServer(params): Promise<ClientConfigResponse>

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

Configure the remote server with the desired codec.

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

Parameters

params
codec

CodecType = "h264"

The 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:418

Check if the client is configured.

Returns

boolean


setEncodedFrameConsumer()

setEncodedFrameConsumer(__namedParameters): Promise<void>

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

Set the encoded frame consumer.

Parameters

__namedParameters
encoded_frame_consumer

EncodedFrameConsumer

Returns

Promise<void>


startStreaming()

startStreaming(): void

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

Start streaming the viewports from the server.

Returns

void


startSimulation()

startSimulation(): void

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

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

Returns

void


pauseSimulation()

pauseSimulation(): void

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

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

Returns

void


stopSimulation()

stopSimulation(): void

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

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

Returns

void


sendSkeletonPose()

sendSkeletonPose(params): void

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

Send a partial skeleton pose targeting a specific animation controller.

Parameters

params
controller

Entity

The entity having the animation controller component.

partial_pose

SkeletonPartialPose

The partial pose to send.

Returns

void


configureHeadlessClient()

configureHeadlessClient(): Promise<ClientConfigResponse>

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

Experimental

Returns

Promise<ClientConfigResponse>