brig/consensus~ Peer

new Peer(id, txopt)

Abstract representation of a peer. Accepts any objectMode=true Duplex stream and a unique ID. Messages sent to peer will be written to the stream. module:brig/consensus~Cluster expects messages from peers to be read from this stream.

Parameters:
NameTypeAttributesDescription
idstring

Peer ID.

txmodule:brig/consensus~peerTxHandler<optional>

User-defined transport.

Extends

  • EventEmitter

Methods

send(message) → {module:brig/consensus~Peer}

Writes the message to the underlying stream.

Parameters:
NameTypeDescription
messagemodule:brig/messages~Message

The message to send.

Fires:
  • module:brig/events~event:MessageQueued