Skip to content

Instantly share code, notes, and snippets.

@Arunshaik2001
Created December 25, 2022 13:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Arunshaik2001/b54d369739307b2c3d4d1e67ec3b7b47 to your computer and use it in GitHub Desktop.
Save Arunshaik2001/b54d369739307b2c3d4d1e67ec3b7b47 to your computer and use it in GitHub Desktop.
fun sendMessage(
message: String,
channel: ManagedChannel?
):String? {
return try {
val stub = GreeterGrpc.newBlockingStub(channel)
val request = HelloRequest.newBuilder().setName(message).build()
val reply = stub.sayHello(request)
reply.message
} catch (e: Exception) {
e.message
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment