Coder Social home page Coder Social logo

Generating code for services? about protox HOT 7 CLOSED

ahamez avatar ahamez commented on May 29, 2024
Generating code for services?

from protox.

Comments (7)

ahamez avatar ahamez commented on May 29, 2024 1

OK, thanks for your detailed answer, it's much clearer now! I hope I'll be able to take a look at all this in a few days, but the next 2 months will be pretty busy, so no promise 😅!

from protox.

wingyplus avatar wingyplus commented on May 29, 2024 1

There is some documentation here and here.

wouldn't it be easier to use elixir-grpc?

That library is unfortunately [no longer maintained])(https://github.com/elixir-grpc/grpc/graphs/contributors), and I would rather have client based on Mint.

how do you serialize it? I mean, as it's not a protobuf struct, what do you send as HTTP payload? JSON?

You don't serialize the service, it is only used to know what type of data to send where. Then you send the serialized protocol buffer over the gRPC protocol (based on HTTP2).

I have a working version, based on the client from Spear, at https://github.com/hkrutzer/grpc_client.

Here you can see an example of how to perform a request. The GrpcClient.Rpc part is what I'm looking for; right now I'm typing it out manually.

Good news, the library has a new maintainer now. :)

from protox.

ahamez avatar ahamez commented on May 29, 2024

Hello,
Good question! TBH, I'm not clear on how protox could support gRPC. For instance, I thought it would required to have some kind of HTTP/2 server. But, it seems that in your case, you juste need to generate some data structures from a service definition. Is that right?

from protox.

hkrutzer avatar hkrutzer commented on May 29, 2024

Yes, to support both client and server gRPC like https://github.com/elixir-grpc/grpc does an HTTP2 server would be needed (perhaps in the future it could work with Bandit. However, I'm only looking for a client right now (based on Mint), and for that a data structure for the service definition is sufficient.

from protox.

ahamez avatar ahamez commented on May 29, 2024

OK, it's clearer, thanks!
However, I can't find the specification of this structure on https://grpc.io/docs or how a service is effectively described in protobuf. Can you point me to some documentation?
Furthermore, how do you serialize it? I mean, as it's not a protobuf struct, what do you send as HTTP payload? JSON?

Also, I take the opportunity of this discussion to ask a naive question: I'm obviously happy that you are using protox 🙂, but wouldn't it be easier to use elixir-grpc? As it's difficult to have feedback for open-source software, I'll be glad to know the features of protox that made you choose it 🙂.

from protox.

hkrutzer avatar hkrutzer commented on May 29, 2024

There is some documentation here and here.

wouldn't it be easier to use elixir-grpc?

That library is unfortunately [no longer maintained])(https://github.com/elixir-grpc/grpc/graphs/contributors), and I would rather have client based on Mint.

how do you serialize it? I mean, as it's not a protobuf struct, what do you send as HTTP payload? JSON?

You don't serialize the service, it is only used to know what type of data to send where. Then you send the serialized protocol buffer over the gRPC protocol (based on HTTP2).

I have a working version, based on the client from Spear, at https://github.com/hkrutzer/grpc_client.

Here you can see an example of how to perform a request. The GrpcClient.Rpc part is what I'm looking for; right now I'm typing it out manually.

from protox.

ahamez avatar ahamez commented on May 29, 2024

As there is an alternative, I'll close this issue, but I'll definitely keep this on my TODO list 😉

from protox.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.