Constructor
new ZyrePeers(options)
Parameters:
Name |
Type |
Description |
options |
object
|
Options object
Properties
Name |
Type |
Attributes |
Description |
identity |
Buffer
|
|
16 byte UUID as Buffer |
evasive |
number
|
<optional>
|
Evasive timeout in ms |
expired |
number
|
<optional>
|
Expired timeout in ms |
|
- Source:
Extends
Methods
(protected) _createHandler()
Creates handler as object properties in a separate method to ensure proper scope via arrow
functions.
- Source:
disconnectAll()
Disconnects from and closes the socket of all peers. Removes all peers from the known peers.
Loses all pending messages of all peers, so only use if the environment changes or the
application closes.
- Source:
exists(identity) → {boolean}
Returns true if a ZyrePeer with the given identity exists.
Parameters:
Name |
Type |
Description |
identity |
string
|
Identity of the peer |
- Source:
Returns:
-
Type
-
boolean
getPeer(identity) → {ZyrePeer}
Returns a ZyrePeer with the given identity.
Parameters:
Name |
Type |
Description |
identity |
string
|
Identity of the peer |
- Source:
Returns:
-
Type
-
ZyrePeer
push(options) → {ZyrePeer}
Updates the ZyrePeer information, creates a new ZyrePeer if it doesn't exist yet.
Parameters:
Name |
Type |
Description |
options |
object
|
Options object
Properties
Name |
Type |
Attributes |
Description |
identity |
string
|
|
Identity of the peer |
sequence |
number
|
<optional>
|
Sequence of the last received message |
address |
string
|
<optional>
|
IP of the peer |
mailbox |
number
|
<optional>
|
Network port of the peer |
endpoint |
string
|
<optional>
|
TCP address of the peer |
status |
number
|
<optional>
|
Group status of the peer |
name |
string
|
<optional>
|
Name of the peer |
headers |
object
|
<optional>
|
Headers of the peer |
|
- Source:
Fires:
Returns:
-
Type
-
ZyrePeer
send(msg)
Sends a ZreMsg message to all known ZyrePeers.
Parameters:
Name |
Type |
Description |
msg |
ZreMsg
|
ZreMsg |
- Source:
Creates an object with public data of all peers.
- Source:
Returns:
-
Type
-
PeersObject
Events
disconnect
Properties:
- Source:
expired
Properties:
- Source:
new
Properties:
- Source: