Constructor
new ZBeacon(options)
Parameters:
Name | Type | Description | |||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
object | Options object
Properties
|
- 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