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:
-
paramsObject-
peerPeerThe peer to invite.
-
sessionSessionThe session you wish the invited peer to join.
-
contextTiBufferAn 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.
-
timeoutNumberThe 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:
-
errorCodeNumberThe error code.
-
errorDomainStringThe error domain.
-
errorDescriptionStringThe error description.
peerFound
This event is fired when a peer is found.
Event Payload:
-
peerPeer -
discoveryInfoObjectThe info dictionary advertised by the discovered peer. For more information on the contents of this dictionary, see the documentation of the createAdvertiser function.
