Logical Labs Multipeer Module

API Docs for: 1.0.0
Show:

MultipeerModule Class

Module: Readme

Methods

createAdvertiserAssistant

(
  • params
)
AdvertiserAssistant

Available since 1.0.0

Creates an AdvertiserAssistant object.

Parameters:

  • params Object
    • serviceType String

      The service type to browse for. Must be 1–15 characters long and can contain only ASCII lowercase letters, numbers, and hyphens.

      This name should be easily distinguished from unrelated services. For example, a text chat app made by ABC company could use the service type abc-txtchat.

    • session Session

      The session to connect the peers to.

    • [discoveryInfo] Object optional

      A dictionary of key-value pairs that are made available to browsers. Each key and value must be a string. This data is advertised using a Bonjour TXT record, encoded according to RFC 6763 (section 6). As a result, the key-value pair must be no longer than 255 bytes (total) when encoded in UTF-8 format with an equals sign (=) between the key and the value, and keys cannot contain an equals sign.

      For optimal performance, the total size of the keys and values in this dictionary should be no more than about 400 bytes so that the entire advertisement can fit within a single Bluetooth data packet.

createPeer

(
  • params
)
Peer

Available since 1.0.0

Creates a Peer object.

Parameters:

  • params Object
    • name String

      Name of the peer.

Returns:

Peer:

hidePicker

() Void

Available since 1.0.0

Dismisses the built-in peer browser view.

See also the showPicker function and the pickerCancel and pickerDone events.

Returns:

Void:

showPicker

(
  • params
)
Void

Available since 1.0.0

Opens the built-in peer browser view. This view will show the nearby peers and allow the user to connect to one or more of them.

See also the hidePicker function and the pickerCancel and pickerDone events.

Parameters:

  • params Object
    • serviceType String

      The service type to browse for. Must be 1–15 characters long and can contain only ASCII lowercase letters, numbers, and hyphens.

      This name should be easily distinguished from unrelated services. For example, a text chat app made by ABC company could use the service type abc-txtchat.

    • session Session

      The session to connect the peers to.

    • [animated] Boolean optional

      Whether or not the view should be displayed and dismissed in an animated fashion.

    • [autoHide] Boolean optional

      Whether or not the view should be automatically dismissed when the user taps Cancel or Done.

    • [maxPeerCount] Number optional

      The maximum number of peers allowed in a session, including the local peer. Defaults to 8.

    • [minPeerCount] Number optional

      The minimum number of peers that need to be in a session, including the local peer. Defaults to 2.

Returns:

Void:

Constants

ENCRYPTION_NONE

Number

Available since 1.0.0

Indicates whether a session should use encryption when communicating with nearby peers.

ENCRYPTION_OPTIONAL

Number

Available since 1.0.0

Indicates whether a session should use encryption when communicating with nearby peers.

ENCRYPTION_REQUIRED

Number

Available since 1.0.0

Indicates whether a session should use encryption when communicating with nearby peers.

ERROR_CANCELLED

Number

Available since 1.0.0

One of the error codes returned by the Multipeer Connectivity Framework.

ERROR_INVALID_PARAMETER

Number

Available since 1.0.0

One of the error codes returned by the Multipeer Connectivity Framework.

ERROR_NOT_CONNECTED

Number

Available since 1.0.0

One of the error codes returned by the Multipeer Connectivity Framework.

ERROR_TIMED_OUT

Number

Available since 1.0.0

One of the error codes returned by the Multipeer Connectivity Framework.

ERROR_UNAVAILABLE

Number

Available since 1.0.0

One of the error codes returned by the Multipeer Connectivity Framework.

ERROR_UNKNOWN

Number

Available since 1.0.0

One of the error codes returned by the Multipeer Connectivity Framework.

ERROR_UNSUPPORTED

Number

Available since 1.0.0

One of the error codes returned by the Multipeer Connectivity Framework.

MAX_PEER_COUNT

Number

Available since 1.0.0

Constant that definens the maximum number of peers supported in a session.

MIN_PEER_COUNT

Number

Available since 1.0.0

Constant that defines the minimum number of peers supported in a session.

SEND_MODE_RELIABLE

Number

Available since 1.0.0

Indicates whether delivery of data should be guaranteed.

SEND_MODE_UNRELIABLE

Number

Available since 1.0.0

Indicates whether delivery of data should be guaranteed.

SESSION_STATE_CONNECTED

Number

Available since 1.0.0

Indicates the current state of a given peer within a session.

SESSION_STATE_CONNECTING

Number

Available since 1.0.0

Indicates the current state of a given peer within a session.

SESSION_STATE_NOT_CONNECTED

Number

Available since 1.0.0

Indicates the current state of a given peer within a session.

Events

pickerCancel

Available since 1.0.0

Fired when the user taps the Cancel button on the built-in peer browser view.

See also the showPicker and hidePicker functions and the pickerDone event.

pickerDone

Available since 1.0.0

Fired when the user taps the Done button on the built-in peer browser view.

See also the showPicker and hidePicker functions and the pickerCancel event.