Server class
A JSON-RPC 2.0 server.
A server exposes methods that are called by requests, to which it provides
responses. Methods can be registered using registerMethod and
registerFallback. Requests can be handled using handleRequest
and
parseRequest
.
Note that since requests can arrive asynchronously and methods can run asynchronously, it's possible for multiple methods to be invoked at the same time, or even for a single method to be invoked multiple times at once.
- Implementers
Constructors
-
Server(StreamChannel<
String> channel) -
Creates a Server that communicates over
channel
. [...] - Server.withoutJson(StreamChannel channel)
-
Creates a Server that communicates using decoded messages over
channel
. [...]
Properties
- done → Future
-
Returns a Future that completes when the underlying connection is
closed. [...]
read-only
- isClosed → bool
-
Whether the underlying connection is closed. [...]
read-only
- hashCode → int
-
The hash code for this object. [...]
read-only, inherited
- runtimeType → Type
-
A representation of the runtime type of the object.
read-only, inherited
Methods
-
close(
) → Future - Closes the underlying connection. [...]
-
listen(
) → Future - Starts listening to the underlying stream. [...]
-
registerFallback(
dynamic callback(Parameters parameters)) → void - Registers a fallback method on this server. [...]
-
registerMethod(
String name, Function callback) → void -
Registers a method named
name
on this server. [...] -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a non-existent method or property is accessed. [...]
inherited
-
toString(
) → String -
Returns a string representation of this object.
inherited
Operators
-
operator ==(
dynamic other) → bool -
The equality operator. [...]
inherited