Get a libp2p-enabled Agent for use with node's http
module. This method
will throw when not running under Node.js or Electron.
All requests using this Agent will be sent to the peer reachable by the peer ID or multiaddr(s) passed as the first argument.
Optional
options: AgentOptionsReturns true if there is a handler registered for the incoming Request or WebSocket.
Note - the .url
property must be set on the WebSocket for this to work.
Not all server-side WebSocket frameworks do this out of the box so the
caller may have to add the property.
Open a WebSocket connection to an HTTP server over libp2p.
If the passed resource
starts with a /
character, it will be
interpreted as a Multiaddr, otherwise it will be interpreted as a URL.
URLs can start with the multiaddr:
scheme if the global URL class in the
runtime environment supports it.
Optional
init: ConnectInitGet a libp2p-enabled Dispatcher for use with the undici
module. This
method will throw when not running under Node.js or Electron.
All requests using this Agent will be sent to the peer reachable by the peer ID or multiaddr(s) passed as the first argument.
Make a request in a similar way to globalThis.fetch.
If the passed resource
is a string, if it starts with a /
character it
will be interpreted as a Multiaddr, otherwise it will be interpreted as a
URL.
URLs can start with the multiaddr:
scheme if the global URL class in the
runtime environment supports it.
Return the protocol->path mappings supported by this server
Register a listener for a HTTP protocol
Remove a listener for a HTTP protocol
HTTP service interface