Abstract Private _registrarIf router can relay received messages, even if not subscribed
if publish should emit to self, if subscribed
Protected enabledThe signature policy to follow by default
Private Readonly maxPrivate Readonly maxMap of peer streams
List of our subscriptions
Topic validator map
Keyed by topic Topic validators are functions with the following input:
Map of topics to which peers are subscribed to
Protected _onOn an inbound stream opened
Protected _onRegistrar notifies an established connection with pubsub protocol
Protected _onRegistrar notifies a closing connection with pubsub protocol
Optional conn: ConnectionProtected _removeNotifies the router that a peer has been disconnected
Notifies the router that a peer has been connected
Normalizes the message and signs it, if signing is enabled. Should be used by the routers to create the message to send.
Abstract decodeDecode Uint8Array into an RPC object. This can be override to use a custom router protobuf.
Abstract encodeEncode RPC object into a Uint8Array. This can be override to use a custom router protobuf.
Abstract encodeEncode RPC object into a Uint8Array. This can be override to use a custom router protobuf.
The default msgID implementation Child class can override this.
Responsible for processing each RPC message received by other peers.
Handles an rpc request from a peer
Handles a subscription change from a peer
Publishes messages to all subscribed peers
Optional data: Uint8ArrayAbstract publishOverriding the implementation of publish should handle the appropriate algorithms for the publish/subscriber implementation. For example, a Floodsub implementation might simply publish each message to each topic for every peer.
sender might be this peer, or we might be forwarding a message on behalf of another peer, in which case sender
is the peer we received the message from, which may not be the peer the message was created by.
PubSubBaseProtocol handles the peers and connections logic for pubsub routers and specifies the API that pubsub routers should have.