Peer class

A JSON-RPC 2.0 client and server.

This supports bidirectional peer-to-peer communication with another JSON-RPC 2.0 endpoint. It sends both requests and responses across the same communication channel and expects to connect to a peer that does the same.

Implemented types

Constructors

Peer(StreamChannel<String> channel)
Creates a Peer that communicates over channel. [...]
Peer.withoutJson(StreamChannel channel)
Creates a Peer that communicates using decoded messages over channel. [...]

Properties

done Future
Returns a Future that completes when the underlying connection is closed. [...]
read-only, override
isClosed bool
Whether the underlying connection is closed. [...]
read-only, override
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. [...]
override
listen() Future
Starts listening to the underlying stream. [...]
override
registerFallback(dynamic callback(Parameters parameters)) → void
Registers a fallback method on this server. [...]
override
registerMethod(String name, Function callback) → void
Registers a method named name on this server. [...]
override
sendNotification(String method, [ dynamic parameters ]) → void
Sends a JSON-RPC 2 request to invoke the given method without expecting a response. [...]
override
sendRequest(String method, [ dynamic parameters ]) Future
Sends a JSON-RPC 2 request to invoke the given method. [...]
override
withBatch(dynamic callback()) → dynamic
Runs callback and batches any requests sent until it returns. [...]
override
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