Preparing search index...

    Class SpectaclesMobileKitSession

    Spectacles Mobile Kit session allows you to initiate the connection to peer, and send data.

    Hierarchy (View Summary)

    Index

    Properties

    isConnected: boolean

    True if we’re connected to the peer.

    onConnected: event0<void>

    Notified when the connection to the peer is established and ready.

    onDisconnected: event0<void>

    Triggered when the connection to the peer is severed. The session is no longer valid and must be re-created.

    Methods

    • Disconnect and stop the session. Session object will be invalid after this call and will need to be re-created.

      Returns void

    • 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

    • Use sendData() to send a one-way message to the connected mobile app. This is a fire-and-forget operation, no response is expected.

      Parameters

      • data: string

      Returns void

    • Send a request expecting a response from the peer. Returns a promise with the response.

      Parameters

      • data: string

      Returns Promise<string>

    • Initialize the session before interacting with the app. Ensure that all callbacks and events are configured prior to calling this method. This action creates the session and begins listening for incoming connections.

      Returns void

    • Start a subscription, multiple responses can be sent by the peer. Returns the subscription event. onError will be called if the subscription is cancelled by peer.

      Parameters

      • data: string
      • onError: (error: string) => void

      Returns event1<string, void>

    • Stop the subscription.

      Parameters

      Returns void