aboutsummaryrefslogtreecommitdiff
path: root/planetwars-client/src
diff options
context:
space:
mode:
authorIlion Beyst <ilion.beyst@gmail.com>2022-06-01 20:19:13 +0200
committerIlion Beyst <ilion.beyst@gmail.com>2022-06-01 20:19:13 +0200
commit0f80b196149a0fb75d84b61c8bbbeb9a71267129 (patch)
treecf353555411c2612f92a861acf97686df5fb51c5 /planetwars-client/src
parentaf5cd69f7b60c07c4830f2eca9b8b1544c7c4972 (diff)
downloadplanetwars.dev-0f80b196149a0fb75d84b61c8bbbeb9a71267129.tar.xz
planetwars.dev-0f80b196149a0fb75d84b61c8bbbeb9a71267129.zip
set up stub grpc client
Diffstat (limited to 'planetwars-client/src')
-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);
+}