Description

Settings for configuring a Connected Lens session.

Example

// @input Asset.ConnectedLensModule connectedLensModule
function createSession() {
var options = ConnectedLensSessionOptions.create();

options.onSessionCreated = onSessionCreated;
options.onConnected = onConnected;
options.onDisconnected = onDisconnected;
options.onMessageReceived = onMessageReceived;
options.onUserJoinedSession = onUserJoinedSession;
options.onUserLeftSession = onUserLeftSession;
options.onError = onError;

script.connectedLensModule.createSession(options);
}```
interface ConnectedLensSessionOptions {
    hostManagementEnabled: boolean;
    maxNumberOfInvitations: number;
    onConnected: ((session, connectionInfo) => void);
    onDisconnected: ((session, disconnectInfo) => void);
    onError: ((session, code, description) => void);
    onHostUpdated: ((session, removalInfo) => void);
    onMessageReceived: ((session, userId, message, senderInfo) => void);
    onRealtimeStoreCreated: ((session, store, ownerInfo, creationInfo) => void);
    onRealtimeStoreDeleted: ((session, store, deleteInfo) => void);
    onRealtimeStoreKeyRemoved: ((session, removalInfo) => void);
    onRealtimeStoreOwnershipUpdated: ((session, store, ownerInfo, ownershipUpdateInfo) => void);
    onRealtimeStoreUpdated: ((session, store, key, updateInfo) => void);
    onSessionCreated: ((session, sessionCreationType) => void);
    onUserJoinedSession: ((session, userInfo) => void);
    onUserLeftSession: ((session, userInfo) => void);
    getTypeName(): string;
    isOfType(type): boolean;
    isSame(other): boolean;
}

Hierarchy (view full)

Properties

hostManagementEnabled: boolean

Description

Provides a single host for every session. Useful when an experience has a single authority. This should not be used in latency sensitive situations. The creator of the session will by default be the host. If the host leaves, thee server will determine a new host and transfer all ownership of entities owned by the original host. Use with onHostUpdated API to get a callback.

maxNumberOfInvitations: number

Description

Defines maximum number of receipients that a user of connected lens can select while sharing a connected lens session via Invitation flow.

onConnected: ((session, connectionInfo) => void)

Type declaration

    • (session, connectionInfo): void
    • Parameters

      Returns void

      Description

      Function to be called when a connection to the realtime backend is established. All realtime requests can be called after this callback. When you invite others to join, a new session will be created, hence you should update your session handler with the argument passed in this callback.

Description

Function to be called when a connection to the realtime backend is established. All realtime requests can be called after this callback. When you invite others to join, a new session will be created, hence you should update your session handler with the argument passed in this callback.

onDisconnected: ((session, disconnectInfo) => void)

Type declaration

    • (session, disconnectInfo): void
    • Parameters

      Returns void

      Description

      Function to be called when the connection to the realtime backend is lost, either via successful disconnect or passive disconnect due to error.

Description

Function to be called when the connection to the realtime backend is lost, either via successful disconnect or passive disconnect due to error.

onError: ((session, code, description) => void)

Type declaration

    • (session, code, description): void
    • Parameters

      Returns void

      Description

      Function to be called when an error occurs in the session life cycle.

Description

Function to be called when an error occurs in the session life cycle.

onHostUpdated: ((session, removalInfo) => void)

Type declaration

onMessageReceived: ((session, userId, message, senderInfo) => void)

Type declaration

    • (session, userId, message, senderInfo): void
    • Parameters

      Returns void

      Description

      Function to be called when a string-based message sent by sendMessage() is received from another user via the realtime backend.

Description

Function to be called when a string-based message sent by sendMessage() is received from another user via the realtime backend.

onRealtimeStoreCreated: ((session, store, ownerInfo, creationInfo) => void)

Type declaration

Description

Callback function that will be executed when a realtime store is created.

onRealtimeStoreDeleted: ((session, store, deleteInfo) => void)

Type declaration

Description

Callback function that will be executed when a realtime store is deleted.

onRealtimeStoreKeyRemoved: ((session, removalInfo) => void)

Type declaration

Description

Function to be called when a key is removed from a RealtimeStore.

onRealtimeStoreOwnershipUpdated: ((session, store, ownerInfo, ownershipUpdateInfo) => void)

Type declaration

Description

Callback function that will be executed when ownership of a realtime store is updated.

onRealtimeStoreUpdated: ((session, store, key, updateInfo) => void)

Type declaration

Description

Callback function that will be executed when a realtime store is updated.

onSessionCreated: ((session, sessionCreationType) => void)

Type declaration

    • (session, sessionCreationType): void
    • Parameters

      Returns void

      Description

      Function called when the session is created. The session creation type in this callback can be used to tell if the session is being created from scratch, or is being received from another user.

Description

Function called when the session is created. The session creation type in this callback can be used to tell if the session is being created from scratch, or is being received from another user.

onUserJoinedSession: ((session, userInfo) => void)

Type declaration

    • (session, userInfo): void
    • Parameters

      Returns void

      Description

      Function to be called when another user joins the session. When joining a session, the current user will get a callback for each of the existing active users in the current session. This way you can build a list of existing players in game.

Description

Function to be called when another user joins the session. When joining a session, the current user will get a callback for each of the existing active users in the current session. This way you can build a list of existing players in game.

onUserLeftSession: ((session, userInfo) => void)

Type declaration

    • (session, userInfo): void
    • Parameters

      Returns void

      Description

      Function to be called when another user leaves the session, either deliberately or via passive disconnect due to error.

Description

Function to be called when another user leaves the session, either deliberately or via passive disconnect due to error.

Methods

  • Parameters

    • type: string

    Returns boolean

    Description

    Returns true if the object matches or derives from the passed in type.

Generated using TypeDoc