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, {ErrorCallback onUnhandledError, bool strictProtocolChecks: true})
Creates a Server that communicates over channel. [...]
Server.withoutJson(StreamChannel channel, {ErrorCallback onUnhandledError, bool strictProtocolChecks: true})
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
hashCode int
The hash code for this object. [...]
read-only, inherited
isClosed bool
Whether the underlying connection is closed. [...]
read-only
onUnhandledError ErrorCallback
A callback that is fired on unhandled exceptions. [...]
final
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited
strictProtocolChecks bool
Whether to strictly enforce the JSON-RPC 2.0 specification for received messages. [...]
final

Methods

close() Future
Closes the underlying connection. [...]
listen() Future
Starts listening to the underlying stream. [...]
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
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. [...]
toString() String
Returns a string representation of this object.
inherited

Operators

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