Last active
August 4, 2023 13:30
-
-
Save daggy1234/954e369d984210885f365a037d3e55a8 to your computer and use it in GitHub Desktop.
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
from rpc_echo_python_client import Connection, HelloRequest | |
c = Connection("0.0.0.0:5000") | |
req = HelloRequest("Hello Request") | |
o = c.say_hello(req) |
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
syntax = "proto3"; | |
package rpc_echo; | |
// The greeting service definition. | |
service Greeter { | |
// Sends a greeting | |
rpc SayHello (HelloRequest) returns (HelloReply) {} | |
} | |
// The request message containing the user's name. | |
message HelloRequest { | |
bytes name = 1; | |
} | |
// The response message containing the greetings | |
message HelloReply { | |
bytes message = 1; | |
} |
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
from rpc_echo_python_server import MyGreeter, HelloRequest, HelloResponse | |
def say_hello(req: HelloRequest) -> HelloResponse: | |
msg = req.message | |
print(f"Got {msg}") | |
return HelloResponse(f"Recieved {msg}!") | |
s = MyGreeter() | |
s.add_say_hello(say_hello) | |
s.run("0.0.0.0:5000") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment