Host class abstract

Host is an object participating in a p2p network, which implements protocols or provides services. It handles requests like a Server, and issues requests like a Client. It is called Host because it is both Server and Client (and Peer may be confusing).

Implementers
Available extensions

Constructors

Host.new()

Properties

addrs List<MultiAddr>
Addrs returns the listen addresses of the Host
no setter
connManager ConnManager
ConnManager returns this hosts connection manager
no setter
eventBus EventBus
EventBus returns the hosts eventbus
no setter
hashCode int
The hash code for this object.
no setterinherited
holePunchService HolePunchService?
Returns the HolePunchService for this host, if available.
no setter
id PeerId
ID returns the (local) peer.ID associated with this Host
no setter
mux ProtocolSwitch
Mux returns the Mux multiplexing incoming streams to protocol handlers
no setter
network Network
Network returns the Network interface of the Host
no setter
peerStore Peerstore
Peerstore returns the Host's repository of Peer Addresses and Keys.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

addStompService({StompServiceOptions? options}) Future<StompService>

Available on Host, provided by the StompHostExtension extension

Adds STOMP service to the host
close() Future<void>
Close shuts down the host, its Network, and services.
connect(AddrInfo pi, {Context? context}) Future<void>
Connect ensures there is a connection between this host and the peer with given peer.ID. Connect will absorb the addresses in pi into its internal peerstore. If there is not an active connection, Connect will issue a h.Network.Dial, and block until a connection is open, or an error is returned.
connectStomp({required PeerId peerId, required String hostName, String? login, String? passcode, Duration? timeout}) Future<StompClient>

Available on Host, provided by the StompHostExtension extension

Creates a STOMP client connection to a peer
newStream(PeerId p, List<ProtocolID> pids, Context context) Future<P2PStream>
NewStream opens a new stream to given peer p, and writes a p2p/protocol header with given ProtocolID. If there is no connection to p, attempts to create one. If ProtocolID is "", writes no header. (Thread-safe)
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
removeStreamHandler(ProtocolID pid) → void
RemoveStreamHandler removes a handler on the mux that was set by SetStreamHandler
setStreamHandler(ProtocolID pid, StreamHandler handler) → void
SetStreamHandler sets the protocol handler on the Host's Mux. This is equivalent to: host.Mux().SetHandler(proto, handler) (Thread-safe)
setStreamHandlerMatch(ProtocolID pid, bool match(ProtocolID), StreamHandler handler) → void
SetStreamHandlerMatch sets the protocol handler on the Host's Mux using a matching function for protocol selection.
start() Future<void>
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited