createCall<Q, R> method
ClientCall<Q, R>
createCall<Q, R>(
- ClientMethod<
Q, R> method, - Stream<
Q> requests, - CallOptions options
Initiates a new RPC on this connection.
Implementation
@override
ClientCall<Q, R> createCall<Q, R>(ClientMethod<Q, R> method, Stream<Q> requests, CallOptions options) {
final call = MyClientCall<Q, R>(
method,
requests,
options,
);
// do the call
final serviceName = method.path.split('/')[1];
final methodName = method.path.split('/')[2];
requests.first.then((request) {
final requestData = (request as GeneratedMessage).writeToBuffer();
embeddingChannel
.invoke(serviceName, data: {'name': serviceName, 'method': methodName, 'data': requestData}).then((response) {
try {
final responseData = method.responseDeserializer(response!);
call.setResponse(responseData);
} catch (e, stackTrace) {
debugPrint('error: $e');
debugPrint('stackTrace: $stackTrace');
}
});
});
return call;
}