Constructor
new ZyreNode(options)
Parameters:
Name |
Type |
Description |
options |
object
|
Options object
Properties
Name |
Type |
Attributes |
Default |
Description |
identity |
Buffer
|
|
|
16 byte UUID as Buffer |
name |
string
|
|
|
Name of the zyre node |
address |
string
|
|
|
Address of the zyre node |
mailbox |
number
|
|
|
Network port of the zyre node |
headers |
object
|
<optional>
|
{}
|
Headers of the zyre node |
zyrePeers |
ZyrePeers
|
|
|
Global ZyrePeers object |
zyreGroups |
ZyreGroups
|
|
|
Global ZyreGroups object |
|
- Source:
Extends
Methods
(protected) _createHandler()
Creates handler as object properties in a separate method to ensure proper scope via arrow
functions.
- Source:
(protected) _messageHandler(id, msg, frame)
Parses the given id and message, updates the peer information found in the message and takes
over message handling.
Parameters:
Name |
Type |
Description |
id |
Buffer
|
16 byte UUID as Buffer with leading byte 01 |
msg |
Buffer
|
Message as binary Buffer |
frame |
Buffer
|
Message content as binary Buffer |
- Source:
Fires:
(protected) _newPeerHandler(zyrePeer)
Connects to the given ZyrePeer and sends a HELLO message.
Parameters:
Name |
Type |
Description |
zyrePeer |
ZyrePeer
|
ZyrePeer |
- Source:
join(group)
Joins a group.
Parameters:
Name |
Type |
Description |
group |
string
|
Name of the group |
- Source:
leave(group)
Leaves a group.
Parameters:
Name |
Type |
Description |
group |
string
|
Name of the group |
- Source:
startListening() → {Promise}
Starts listening for foreign messages, manages incoming messages as defined in ZRE.
- Source:
Fires:
Returns:
-
Type
-
Promise
stopListening() → {Promise}
Stops listening for messages and closes the socket.
- Source:
Returns:
-
Type
-
Promise
Events
hello
Properties:
Name |
Type |
Description |
zyrePeer |
ZyrePeer
|
ZyrePeer |
- Source:
join
Properties:
Name |
Type |
Description |
zyrePeer |
ZyrePeer
|
ZyrePeer |
group |
string
|
Name of the group |
- Source:
leave
Properties:
Name |
Type |
Description |
zyrePeer |
ZyrePeer
|
ZyrePeer |
group |
string
|
Name of the group |
- Source:
shout
Properties:
Name |
Type |
Description |
zyrePeer |
ZyrePeer
|
ZyrePeer |
content |
Buffer
|
Content of the message |
group |
string
|
Name of the group |
- Source:
whisper
Properties:
Name |
Type |
Description |
zyrePeer |
ZyrePeer
|
ZyrePeer |
content |
Buffer
|
Content of the message |
- Source: