Retrieve the registered handler for a given protocol.
The protocol to query.
A StreamHandlerRecord
containing the handler and options.
Retrieve the list of registered protocol handlers.
An array of protocol strings.
Retrieve all topology handlers that are interested in peers supporting a given protocol.
The protocol to query.
An array of registered Topology
handlers.
Register a handler for a specific protocol.
The protocol string (e.g., /my-protocol/1.0.0
).
The function that handles incoming streams.
Optional
options: StreamHandlerOptionsOptional configuration options for the handler.
A promise that resolves once the handler is registered.
Register a topology handler for a protocol - the topology will be invoked when peers are discovered on the network that support the passed protocol.
An id will be returned that can later be used to unregister the topology.
The protocol to register.
The topology handler to register.
A promise resolving to a unique ID for the registered topology.
Remove a registered protocol handler.
The protocol to unhandle.
A promise that resolves once the handler is removed.
Unregister a topology handler using its unique ID.
The ID of the topology to unregister.
The
Registrar
provides an interface for registering protocol handlers - these are invoked when remote peers open streams on the local node with the corresponding protocol name.It also allows configuring network topologies for a given protocol(s). The topology callbacks are invoked when a peer that supports those protocols connects or disconnects.
The Identify protocol must be configured on the current node for topologies to function.