Retrieve the registered handler for a given protocol.
The protocol to query.
A StreamHandlerRecord containing the handler and options.
Return a fresh chain with global middleware before protocol-specific middleware. Mutating the result does not change registered middleware.
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.
Optionaloptions: StreamHandlerOptions
Optional 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.
Optionaloptions: AbortOptionsA promise resolving to a unique ID for the registered topology.
Remove a registered protocol handler.
The protocol to unhandle.
Optionaloptions: AbortOptionsA promise that resolves once the handler is removed.
Unregister a topology handler using its unique ID.
The ID of the topology to unregister.
Remove all global registrations of the given middleware.
Remove the middleware registered for a protocol.
Append global middleware, invoked before protocol-specific middleware. This does not register a handler or advertise protocol support.
Replace the middleware registered for a protocol.
The
Registrarprovides 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.