Add a manual peer to initiate peering process
The switch will periodically reach out to this peer to build its peer database
Receive a message from a connection
This message will get sent to our local node, which may then rebroadcast it
Our own peer information
Send a message to one or more peers
If they are already connected that connection will be re-used, otherwise a new connection will be established.
If "to" is null then it will be sent to a sampling of peers
Where to send the message
Unique message identifier
Message type
Message data, must be serializable to JSON
Optional
ttl: numberMaximum number of hops to pass through
Optional
exclude: (string | P2PConnection)[]List of connections to exclude (e.g., because we got the message from that connection) if "to" is null
Skip creating new connections to send to, only connected clients will be sent the message
If the message could be delivered to at least one peer
Stop this switch
Handle any waiting that needs to be done
Static
parseStatic
Register
A P2PSwitch is a method of coordinating messages from peers (either connected or known) with a Node.