Create a new instance.
Get if this instance is considered the leader of the nodes running on this local machine.
true
if this instance is the leader
Event emitted if this instance becomes the leader of nodes running on this local machine.
instance.onLeader(() => {
// Do something here, such as starting another transport
});
subscribable
Event for when a new peer is connected via this transport.
Subscribable
that can be used to register listeners
Get if transport is started.
true
if transport is started
Add a peer to this transport. This will start monitoring this peer for connection events and make it available/unavailable as it connects/disconnects.
Start this transport.
boolean indicating if the transport was started
Stop this transport.
boolean indicating if the transport was stopped.
Generated using TypeDoc
Machine local transport. Uses Unix sockets to connect to peers on the same machine.
Usage example:
The event onLeader or the option MachineLocalTransportOptions.onLeader can be used to perform actions if the transport instance becomes the leader of nodes running on the local machine.
Example starting a TCP transport when becoming the leader: