Logical Labs Multipeer Module

API Docs for: 1.0.0
Show:

Advertiser Class

Module: Readme

Objects of this class publish an advertisement for a specific service that your app provides and notifies your app about invitations from nearby peers.

Before you can advertise a service, you must create a Peer object that identifies your app and the user to nearby devices.

Methods

inviteResponse

(
  • params
)
Void

Available since 1.0.0

Call this method after you received a receivedInvite event to accept or reject an invitation.

Parameters:

  • params Object
    • inviteId Number

      The ID of the invite you are responding to.

    • accept Boolean

      true if you wish to accept the invite, false otherwise.

    • session Session

      The session with which to associate the peer that sent the invitate.

Returns:

Void:

start

() Void

Available since 1.0.0

Begins advertising the service provided by a local peer.

Returns:

Void:

stop

() Void

Available since 1.0.0

Stops advertising the service provided by a local peer.

Returns:

Void:

Properties

discoveryInfo

Object read-only

Available since 1.0.0

The discoveryInfo passed when this Advertiser was created.

peer

Peer read-only

Available since 1.0.0

The Peer object associated with this Advertiser.

serviceType

String read-only

Available since 1.0.0

The service type that your app is advertising.

Events

error

Available since 1.0.0

This event is fired if something goes wrong with the advertising.

Event Payload:

  • errorCode Number

    The error code.

  • errorDomain String

    The error domain.

  • errorDescription String

    The error description.

receivedInvite

Available since 1.0.0

This event is fired when an invite is received from a remote peer. You must call the inviteResponse function in response to this event to accept or reject the invitation.

Event Payload:

  • remotePeer Peer

    The peer sending the invite.

  • context TiBuffer

    The context received with the invite. May be null.

  • inviteId Number

    An integer that identifies the invite. Use this when calling the inviteResponse function to accept or reject the invitation.