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.
no setter
hashCode int
The hash code for this object.
no setterinherited
isClosed bool
Whether the underlying connection is closed.
no setter
onUnhandledError ErrorCallback?
A callback that is fired on unhandled exceptions.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
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 nonexistent 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
A string representation of this object.
inherited

Operators

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