Connected Lenses Module allows use of networked Lens communication capabilities (real-time communication, co-located session creation and joining, and shared persistent storage). It's recommended to only use one ConnectedLensModule per Lens.

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 ConnectedLensModule {
    name: string;
    uniqueIdentifier: string;
    createSession(sessionOptions: ConnectedLensSessionOptions): void;
    getTypeName(): string;
    isOfType(type: string): boolean;
    isSame(other: ScriptObject): boolean;
    shareSession(sessionShareType: SessionShareType, onSessionShared: ((session: MultiplayerSession, snapcode: Texture) => void)): void;
}

Hierarchy (view full)

Properties

name: string

The name of the Asset in Lens Studio.

uniqueIdentifier: string

Methods

  • Create session with the provided options. Will also check if there is a session that can be created from a session sharetype received from other users.

    Parameters

    Returns void

  • Returns the name of this object's type.

    Returns string

  • 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

  • Share the session with other users, specified by the SessionShareType. Note that if shared via Invitation, a new session will be created. Expect a new onConnected callback with the new session being passed in.

    Parameters

    Returns void