RpcPeerContract class abstract
Bidirectional peer contract — registers handlers AND makes outgoing calls through the same RpcPeerEndpoint.
Extend this class to define a peer protocol:
- Override setup and call addUnaryMethod / addServerStreamMethod / addClientStreamMethod / addBidirectionalMethod to handle incoming requests.
- Use
callUnary/callServerStream/callClientStream/callBidirectionalStreamto initiate outgoing calls to the remote peer.
Register the contract with RpcPeerEndpoint.registerServiceContract.
- Inheritance
-
- Object
- RpcResponderContract
- RpcPeerContract
Constructors
- RpcPeerContract(String serviceName, RpcPeerEndpoint endpoint, {RpcDataTransferMode dataTransferMode = RpcDataTransferMode.auto, RpcDataTransferMode callerDataTransferMode = RpcDataTransferMode.auto})
-
Creates a peer contract bound to
serviceNameandendpoint.
Properties
- callerDataTransferMode → RpcDataTransferMode
-
Data transfer mode used by this contract's outgoing calls.
final
- dataTransferMode → RpcDataTransferMode
-
Data transfer mode used by this contract's methods.
finalinherited
- endpoint → RpcPeerEndpoint
-
The peer endpoint this contract is bound to.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- serviceName → String
-
The service the calls address.
no setterinherited
Methods
-
addBidirectionalMethod<
TRequest extends Object, TResponse extends Object> ({required String methodName, required Stream< TResponse> handler(Stream<TRequest> , {RpcContext? context}), IRpcCodec<TRequest> ? requestCodec, IRpcCodec<TResponse> ? responseCodec, String description = ''}) → void -
Registers a bidirectional stream with automatic mode selection.
inherited
-
addClientStreamMethod<
TRequest extends Object, TResponse extends Object> ({required String methodName, required Future< TResponse> handler(Stream<TRequest> , {RpcContext? context}), IRpcCodec<TRequest> ? requestCodec, IRpcCodec<TResponse> ? responseCodec, String description = ''}) → void -
Registers a client stream with automatic mode selection.
inherited
-
addServerStreamMethod<
TRequest extends Object, TResponse extends Object> ({required String methodName, required Stream< TResponse> handler(TRequest, {RpcContext? context}), IRpcCodec<TRequest> ? requestCodec, IRpcCodec<TResponse> ? responseCodec, String description = ''}) → void -
Registers a server stream with automatic mode selection.
inherited
-
addUnaryMethod<
TRequest extends Object, TResponse extends Object> ({required String methodName, required Future< TResponse> handler(TRequest, {RpcContext? context}), IRpcCodec<TRequest> ? requestCodec, IRpcCodec<TResponse> ? responseCodec, String description = ''}) → void -
Registers a unary method with automatic mode selection.
inherited
-
callBidirectionalStream<
TRequest extends Object, TResponse extends Object> ({required String methodName, required Stream< TRequest> requests, IRpcCodec<TRequest> ? requestCodec, IRpcCodec<TResponse> ? responseCodec, RpcContext? context}) → Stream<TResponse> -
Opens a bidirectional-stream call over
requests.inherited -
callClientStream<
TRequest extends Object, TResponse extends Object> ({required String methodName, required Stream< TRequest> requests, IRpcCodec<TRequest> ? requestCodec, IRpcCodec<TResponse> ? responseCodec, RpcContext? context}) → Future<TResponse> -
Opens a client-stream call over
requests.inherited -
callServerStream<
TRequest extends Object, TResponse extends Object> ({required String methodName, required TRequest request, IRpcCodec< TRequest> ? requestCodec, IRpcCodec<TResponse> ? responseCodec, RpcContext? context}) → Stream<TResponse> -
Opens a server-stream call.
inherited
-
callUnary<
TRequest extends Object, TResponse extends Object> ({required String methodName, required TRequest request, IRpcCodec< TRequest> ? requestCodec, IRpcCodec<TResponse> ? responseCodec, RpcContext? context}) → Future<TResponse> -
Sends a unary request.
inherited
-
dispose(
) → void -
Releases contract resources during deregistration.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
setup(
) → void -
Declarative method registration hook.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited