First, assuming that that is a protobuf service, you will need to have a
proto file that describes it in order to make the requests. You should be
able to get that file from the service provider. Once you have that, there
are two main packages for using proto files with the Node gRPC libraries:
one is @grpc/proto-loader, which loads proto files at runtime, and the
other is grpc-tools, which generates files that depend on the
google-protobuf package. These two packages have different ways of
representing proto messages: proto-loader uses plain JavaScript objects
with structures matching the message definitions, while grpc-tools provides
message classes with getters and setters for the different message fields.
In both cases, once you load the code up with the gRPC package (we
recommend @grpc/grpc-js), you will get a class
this.app.rpc.CompactTxStreamer that can be constructed with a specific
server address (such as "main.company.com:9067"), and the concrete object
will have a method GetNetworkInfo that can be called with parameters that
depend on whether the request is streaming from the client or server. The
API looks like the corresponding make[Something]Request method of the Client
class <https://grpc.github.io/grpc/node/grpc.Client.html>, but without the
first three parameters.

On Thu, May 27, 2021 at 6:38 AM Elliot Blanchard <[email protected]>
wrote:

> Hi,
>
> I'm just getting started with gRPC and I have a basic question about
> making client calls via Node.js.
>
> I've been given a working grpcurl call to an existing gRPC server in the
> form:
>
> grpcurl main.company.com:9067
> this.app.sdk.rpc.CompactTxStreamer/GetNetworkInfo
>
> What is the best way to work backwards from that grpcurl call to be able
> to make the same call using the node.js gRPC architecture? Would I create
> a proto file for the client that I would then call? If so, how would
> those parameters translate into the proto format?
>
> Thank you for your help!
>
> --
> You received this message because you are subscribed to the Google Groups "
> grpc.io" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/grpc-io/28bbad75-af29-473d-8aac-1f96265f5e65n%40googlegroups.com
> <https://groups.google.com/d/msgid/grpc-io/28bbad75-af29-473d-8aac-1f96265f5e65n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"grpc.io" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/grpc-io/CAPK2-4eHQe6StQ-e%3DUqUXhNLoHfJtWLV4gd_6_GnCcXKLUy4Tw%40mail.gmail.com.

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

Reply via email to