Search code examples
powershellgrpcurl

grpcurl: how to invoke bi-directional streaming rpc in powershell?


How to invoke, in Powershell, bi-directional streaming rpc or server streaming rpc with grpcurl.exe and be able to send/receive messages continuously?

I have:

service Info {
  ...
  rpc LocationUpdates ( stream .reqLocation ) return ( stream .resNewLocation ) {}
  ...
}

I use:

grpcurl -vv -H $token -import-path $proto_path -proto info.proto -d $request_message $server Info/LocationUpdates

and I get:

Resolved method descriptor:
rpc LocationUpdates ( stream .reqLocation ) returns ( stream .resNewLocation );

Request metadata to send:
authorization: Bearer ...

Response headers received:
(empty)

Response trailers received:
content-type: application/grpc
Sent 1 request and received 0 responses

In BloomRPC it works, but I prefer grpcurl from command line.


Solution

  • please try this:

    grpcurl -vv -H $token -import-path $proto_path -proto info.proto -d @ $server Info/LocationUpdates<<EOF
    $data1
    $data2
    $data3
    EOF
    

    you will receive three responses from server.