Advertiser Class
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.
Item Index
Methods
Properties
Events
Methods
inviteResponse
-
params
Call this method after you received a receivedInvite event to accept or reject an invitation.
Parameters:
-
params
Object-
inviteId
NumberThe ID of the invite you are responding to.
-
accept
Booleantrue
if you wish to accept the invite,false
otherwise. -
session
SessionThe session with which to associate the peer that sent the invitate.
-
Returns:
start
()
Void
Begins advertising the service provided by a local peer.
Returns:
stop
()
Void
Stops advertising the service provided by a local peer.
Returns:
Properties
discoveryInfo
Object
read-only
The discoveryInfo
passed when this Advertiser was created.
serviceType
String
read-only
The service type that your app is advertising.
Events
error
This event is fired if something goes wrong with the advertising.
Event Payload:
-
errorCode
NumberThe error code.
-
errorDomain
StringThe error domain.
-
errorDescription
StringThe error description.
receivedInvite
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
PeerThe peer sending the invite.
-
context
TiBufferThe context received with the invite. May be null.
-
inviteId
NumberAn integer that identifies the invite. Use this when calling the inviteResponse function to accept or reject the invitation.