BaseMultiplayerSessionOptions
ClassBase class for MultiplayerSession options.
- Available on all platforms
Base class for MultiplayerSession options. This class is not used directly - use ConnectedLensSessionOptions instead.
Index
Properties
Methods
Extends
Extended by
Properties
hostManagementEnabled
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.
Default Value
false
matchmakingConfig
matchmakingConfig:
MatchmakingConfig
Optional matchmaking configuration. If set, matchmaking will be enabled when creating a session.
Since
Lens Scripting Version 375
Default Value
null
onConnected
onConnected: (
session,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.
Parameters
| Parameter | Type |
|---|---|
session | MultiplayerSession |
connectionInfo | ConnectionInfo |
Returns
void
Since
Lens Scripting Version 148
onDisconnected
onDisconnected: (
session,disconnectInfo) =>void
Function to be called when the connection to the realtime backend is lost, either via successful disconnect or passive disconnect due to error.
Parameters
| Parameter | Type |
|---|---|
session | MultiplayerSession |
disconnectInfo | string |
Returns
void
Since
Lens Scripting Version 148
onError
onError: (
session,code,description) =>void
Function to be called when an error occurs in the session life cycle.
Parameters
| Parameter | Type |
|---|---|
session | MultiplayerSession |
code | string |
description | string |
Returns
void
Since
Lens Scripting Version 148
onHostUpdated
onHostUpdated: (
session,removalInfo) =>void
Parameters
| Parameter | Type |
|---|---|
session | MultiplayerSession |
removalInfo | HostUpdateInfo |
Returns
void
Since
Lens Scripting Version 184
Default Value
null
onLobbyStateChanged
onLobbyStateChanged: (
session,lobbyState) =>void
Camera Kit
Function called on every participant when the server confirms the gate of an open-lobby session. The first confirmation can repeat the current state. A player who joins after the confirmation gets no call; read MultiplayerSession#getLobbyState in onConnected instead. Handling this is optional.
Parameters
| Parameter | Type |
|---|---|
session | MultiplayerSession |
lobbyState | LobbyState |
Returns
void
Since
Lens Scripting Version 387
Example
options.onLobbyStateChanged = function (session, lobbyState) {
print("lobby state: " + lobbyState);
};
onMessageReceived
onMessageReceived: (
session,userId,message,senderInfo) =>void
Function to be called when a string-based message sent by sendMessage() is received from another user via the realtime backend.
Parameters
| Parameter | Type |
|---|---|
session | MultiplayerSession |
userId | string |
message | string |
senderInfo | UserInfo |
Returns
void
Since
Lens Scripting Version 148
onRealtimeStoreCreated
onRealtimeStoreCreated: (
session,store,ownerInfo,creationInfo) =>void
Callback function that will be executed when a realtime store is created.
Parameters
| Parameter | Type |
|---|---|
session | MultiplayerSession |
store | GeneralDataStore |
ownerInfo | UserInfo |
creationInfo | RealtimeStoreCreationInfo |
Returns
void
Since
Lens Scripting Version 173
Default Value
null
onRealtimeStoreDeleted
onRealtimeStoreDeleted: (
session,store,deleteInfo) =>void
Callback function that will be executed when a realtime store is deleted.
Parameters
| Parameter | Type |
|---|---|
session | MultiplayerSession |
store | GeneralDataStore |
deleteInfo | RealtimeStoreDeleteInfo |
Returns
void
Since
Lens Scripting Version 173
Default Value
null
onRealtimeStoreKeyRemoved
onRealtimeStoreKeyRemoved: (
session,removalInfo) =>void
Function to be called when a key is removed from a RealtimeStore.
Parameters
| Parameter | Type |
|---|---|
session | MultiplayerSession |
removalInfo | RealtimeStoreKeyRemovalInfo |
Returns
void
Since
Lens Scripting Version 181
Default Value
null
onRealtimeStoreOwnershipUpdated
onRealtimeStoreOwnershipUpdated: (
session,store,ownerInfo,ownershipUpdateInfo) =>void
Callback function that will be executed when ownership of a realtime store is updated.
Parameters
| Parameter | Type |
|---|---|
session | MultiplayerSession |
store | GeneralDataStore |
ownerInfo | UserInfo |
ownershipUpdateInfo | RealtimeStoreOwnershipUpdateInfo |
Returns
void
Since
Lens Scripting Version 173
Default Value
null
onRealtimeStoreUpdated
onRealtimeStoreUpdated: (
session,store,key,updateInfo) =>void
Callback function that will be executed when a realtime store is updated.
Parameters
| Parameter | Type |
|---|---|
session | MultiplayerSession |
store | GeneralDataStore |
key | string |
updateInfo | RealtimeStoreUpdateInfo |
Returns
void
Since
Lens Scripting Version 173
Default Value
null
onUserJoinedSession
onUserJoinedSession: (
session,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.
Parameters
| Parameter | Type |
|---|---|
session | MultiplayerSession |
userInfo | UserInfo |
Returns
void
Since
Lens Scripting Version 148
onUserLeftSession
onUserLeftSession: (
session,userInfo) =>void
Function to be called when another user leaves the session, either deliberately or via passive disconnect due to error.
Parameters
| Parameter | Type |
|---|---|
session | MultiplayerSession |
userInfo | UserInfo |
Returns
void
Since
Lens Scripting Version 148
Methods
getTypeName()
staticgetTypeName():TypeName<BaseMultiplayerSessionOptions>
Returns the fully-qualified JavaScript type name for this class (for example, "Component.Camera"). This is a static accessor (no instance required) and returns the same value as the instance getTypeName().
Returns
TypeName<BaseMultiplayerSessionOptions>
Overrides
getTypeName()
getTypeName():
string
Returns the name of this object's type.
Returns
string
Inherited from
isOfType()
isOfType(
type):boolean
Returns true if the object matches or derives from the passed in type.
Parameters
| Parameter | Type |
|---|---|
type | string |
Returns
boolean
Inherited from
isSame()
isSame(
other):boolean
Returns true if this object is the same as other. Useful for checking if two references point to the same thing.
Parameters
| Parameter | Type |
|---|---|
other | ScriptObject |
Returns
boolean