ServerProxyBase class abstract
ServerProxyBase is a base class for a JSON-RPC v2 client.
ServerProxyBase is intended to be subclassed. It does most of the
client-side functionality needed for JSON-RPC v2, but the transport details
are missing and must be provided by overriding the transmit method.
ServerProxy
in jsonrpc_client.dart
is an implementation.
basic usage (ServerProxy here is a descendant class of ServerProxyBase):
import 'package:jsonrpc2/jsonrpc_client.dart'
var url = 'http://some/location';
var proxy = new ServerProxy(url);
try{
var response = await proxy.call('someServerMethod', [arg1, arg2 ]);
}on RemoteException (e){\\do something with exception e}
doSomethingWithValue(response);
Each arg must be representable in json.
Exceptions on the remote end may throw RemoteException
.
Constructors
- ServerProxyBase(dynamic resource)
- Initialize with the identifier for the server resource
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- resource ↔ dynamic
-
Proxy will be initialized with some sort of remote resource, so make
a place for it.
getter/setter pair
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
call(
String method, [dynamic params]) → Future - Call a method on the remote server, and get a response
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
notify(
String method, [dynamic params]) → void - Call the method on the server. Returns nothing
-
toString(
) → String -
A string representation of this object.
inherited
-
transmit(
String package) → Future< String> - Transmit a JSON-RPC String. Receive a response, and return it.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited