Created
December 30, 2019 10:26
-
-
Save gistlyn/aff6dbb58521d364c9a84aea7ea0647f to your computer and use it in GitHub Desktop.
Dart Google protoc SSL GrpcServicesClient TodoWorld Example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'dart:io'; | |
import 'package:grpc/grpc.dart'; | |
import 'package:TodoWorld/services.pb.dart'; | |
import 'package:TodoWorld/services.pbgrpc.dart'; | |
void main(List<String> args) async { | |
var client = GrpcServicesClient(ClientChannel('todoworld.servicestack.net', port:50051, | |
options:ChannelOptions(credentials: ChannelCredentials.secure( | |
certificates: File('grpc.crt').readAsBytesSync(), | |
authority: 'todoworld.servicestack.net')))); | |
var response = await client.getHello(Hello()..name = 'gRPC Dart'); | |
print(response.result); | |
exit(0); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment