Base class for MultiplayerSession options. This class is not used directly - use ConnectedLensSessionOptions instead.

interface BaseMultiplayerSessionOptions {
    hostManagementEnabled: boolean;
    onConnected: ((session: MultiplayerSession, connectionInfo: ConnectionInfo) => void);
    onDisconnected: ((session: MultiplayerSession, disconnectInfo: string) => void);
    onError: ((session: MultiplayerSession, code: string, description: string) => void);
    onHostUpdated: ((session: MultiplayerSession, removalInfo: HostUpdateInfo) => void);
    onMessageReceived: ((session: MultiplayerSession, userId: string, message: string, senderInfo: UserInfo) => void);
    onRealtimeStoreCreated: ((session: MultiplayerSession, store: GeneralDataStore, ownerInfo: UserInfo, creationInfo: RealtimeStoreCreationInfo) => void);
    onRealtimeStoreDeleted: ((session: MultiplayerSession, store: GeneralDataStore, deleteInfo: RealtimeStoreDeleteInfo) => void);
    onRealtimeStoreKeyRemoved: ((session: MultiplayerSession, removalInfo: RealtimeStoreKeyRemovalInfo) => void);
    onRealtimeStoreOwnershipUpdated: ((session: MultiplayerSession, store: GeneralDataStore, ownerInfo: UserInfo, ownershipUpdateInfo: RealtimeStoreOwnershipUpdateInfo) => void);
    onRealtimeStoreUpdated: ((session: MultiplayerSession, store: GeneralDataStore, key: string, updateInfo: RealtimeStoreUpdateInfo) => void);
    onUserJoinedSession: ((session: MultiplayerSession, userInfo: UserInfo) => void);
    onUserLeftSession: ((session: MultiplayerSession, userInfo: UserInfo) => void);
    getTypeName(): string;
    isOfType(type: string): boolean;
    isSame(other: ScriptObject): boolean;
}

Hierarchy (view full)

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.

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.

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.

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

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

onHostUpdated: ((session: MultiplayerSession, removalInfo: HostUpdateInfo) => void)
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.

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

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

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

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

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

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

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

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

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

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

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.

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.

Methods

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

    Parameters

    • type: string

    Returns boolean

  • Returns true if this object is the same as other. Useful for checking if two references point to the same thing.

    Parameters

    Returns boolean