aboutsummaryrefslogtreecommitdiff
path: root/planetwars-client/src/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'planetwars-client/src/main.rs')
-rw-r--r--planetwars-client/src/main.rs21
1 files changed, 21 insertions, 0 deletions
diff --git a/planetwars-client/src/main.rs b/planetwars-client/src/main.rs
new file mode 100644
index 0000000..9d9bdab
--- /dev/null
+++ b/planetwars-client/src/main.rs
@@ -0,0 +1,21 @@
+pub mod pb {
+ tonic::include_proto!("grpc.planetwars.bot_api");
+}
+
+use pb::test_service_client::TestServiceClient;
+use pb::{Hello, HelloResponse};
+use tonic::Response;
+
+#[tokio::main]
+async fn main() {
+ let mut client = TestServiceClient::connect("http://localhost:50051")
+ .await
+ .unwrap();
+ let response: Response<HelloResponse> = client
+ .greet(Hello {
+ hello_message: "robbe".to_string(),
+ })
+ .await
+ .unwrap();
+ println!("{}", response.get_ref().response);
+}