Router class abstract
Router is an interface that allows users to add and remove protocol handlers, which will be invoked when incoming stream requests for registered protocols are accepted.
Upon receiving an incoming stream request, the Router will check all registered protocol handlers to determine which (if any) is capable of handling the stream. The handlers are checked in order of registration; if multiple handlers are eligible, only the first to be registered will be invoked.
- Implementers
Constructors
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
addHandler(
ProtocolID protocol, HandlerFunc handler) → void - AddHandler registers the given handler to be invoked for an exact literal match of the given protocol ID string.
-
addHandlerWithFunc(
ProtocolID protocol, bool match(ProtocolID), HandlerFunc handler) → Future< void> - AddHandlerWithFunc registers the given handler to be invoked when the provided match function returns true.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
protocols(
) → Future< List< ProtocolID> > - Protocols returns a list of all registered protocol ID strings. Note that the Router may be able to handle protocol IDs not included in this list if handlers were added with match functions using AddHandlerWithFunc.
-
removeHandler(
ProtocolID protocol) → void - RemoveHandler removes the registered handler (if any) for the given protocol ID string.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited