Browser Class
Searches (by service type) for services offered by nearby devices using infrastructure Wi-Fi, peer-to-peer Wi-Fi, and Bluetooth, and provides the ability to easily invite those devices to a Multipeer Connectivity session.
Item Index
Methods
Properties
Methods
invitePeer
-
params
Invites a discovered peer to join a Multipeer Connectivity session.
Parameters:
-
params
Object-
peer
PeerThe peer to invite.
-
session
SessionThe session you wish the invited peer to join.
-
context
TiBufferAn arbitrary piece of data that is passed to the nearby peer. This can be used to provide further information to the user about the nature of the invitation.
-
timeout
NumberThe amount of time to wait for the peer to respond to the invitation. This timeout is measured in seconds, and must be a positive value. If a negative value or zero is specified, the default timeout (30 seconds) is used.
-
Returns:
start
()
Void
Starts browsing for peers.
Returns:
stop
()
Void
Stops browsing for peers.
Returns:
Properties
serviceType
String
read-only
The service type to browse for.
Events
error
This event is fired if something goes wrong with browsing.
Event Payload:
-
errorCode
NumberThe error code.
-
errorDomain
StringThe error domain.
-
errorDescription
StringThe error description.
peerFound
This event is fired when a peer is found.
Event Payload:
-
peer
Peer -
discoveryInfo
ObjectThe info dictionary advertised by the discovered peer. For more information on the contents of this dictionary, see the documentation of the createAdvertiser function.