Preparing search index...

    Class ConnectedLensSessionOptions

    Settings for configuring a Connected Lens session.

    // @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);
    }

    Hierarchy (View Summary)

    Index

    Properties

    hostManagementEnabled: boolean

    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.

    false
    
    maxNumberOfInvitations: number

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

    Lens Scripting Version 158

    64
    
    onConnected: (
        session: MultiplayerSession,
        connectionInfo: ConnectionInfo,
    ) => void

    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.

    Lens Scripting Version 148

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

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

    Lens Scripting Version 148

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

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

    Lens Scripting Version 148

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

    Lens Scripting Version 184

    null
    
    onMessageReceived: (
        session: MultiplayerSession,
        userId: string,
        message: string,
        senderInfo: UserInfo,
    ) => void

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

    Lens Scripting Version 148

    onRealtimeStoreCreated: (
        session: MultiplayerSession,
        store: GeneralDataStore,
        ownerInfo: UserInfo,
        creationInfo: RealtimeStoreCreationInfo,
    ) => void

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

    Lens Scripting Version 173

    null
    
    onRealtimeStoreDeleted: (
        session: MultiplayerSession,
        store: GeneralDataStore,
        deleteInfo: RealtimeStoreDeleteInfo,
    ) => void

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

    Lens Scripting Version 173

    null
    
    onRealtimeStoreKeyRemoved: (
        session: MultiplayerSession,
        removalInfo: RealtimeStoreKeyRemovalInfo,
    ) => void

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

    Lens Scripting Version 181

    null
    
    onRealtimeStoreOwnershipUpdated: (
        session: MultiplayerSession,
        store: GeneralDataStore,
        ownerInfo: UserInfo,
        ownershipUpdateInfo: RealtimeStoreOwnershipUpdateInfo,
    ) => void

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

    Lens Scripting Version 173

    null
    
    onRealtimeStoreUpdated: (
        session: MultiplayerSession,
        store: GeneralDataStore,
        key: string,
        updateInfo: RealtimeStoreUpdateInfo,
    ) => void

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

    Lens Scripting Version 173

    null
    
    onSessionCreated: (
        session: MultiplayerSession,
        sessionCreationType: SessionCreationType,
    ) => void

    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.

    Lens Scripting Version 148

    null
    
    onUserJoinedSession: (session: MultiplayerSession, userInfo: UserInfo) => void

    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.

    Lens Scripting Version 148

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

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

    Lens Scripting Version 148

    Methods