Class: ZBeacon

ZBeacon(options)

ZBeacon implements the discovery beacon defined in the ZRE protocol, it listens for foreign beacons and broadcasts his own datagram.

Constructor

new ZBeacon(options)

Parameters:
Name Type Description
options object Options object
Properties
Name Type Attributes Default Description
identity Buffer 16 byte UUID as Buffer
mailbox number Mailbox of the zyre node
ifaceData IfaceData Interface data
port number <optional>
5670 Broadcast port
interval number <optional>
1000 Interval of the beacon in ms
zyrePeers ZyrePeers Global ZyrePeers object
Source:

Methods

(protected) _createHandler()

Creates handler as object properties in a separate method to ensure proper scope via arrow functions.
Source:

(protected) _messageHandler(msg, rinfo)

Parses the given msg if it is a valid ZRE Beacon and updates the peer information
Parameters:
Name Type Description
msg Buffer Message as binary Buffer
rinfo object Information about remote client
Source:

start() → {Promise}

Starts listening and broadcasting.
Source:
Returns:
Type
Promise

startBroadcasting() → {Promise}

Starts broadcasting the beacon.
Source:
Returns:
Type
Promise

startListening() → {Promise}

Starts listening for foreign beacons and pushes discovered peers to the ZyrePeers object.
Source:
Returns:
Type
Promise

stop() → {Promise}

Sends disconnect beacon and stops every activity.
Source:
Returns:
Type
Promise