stephenh / ts-proto

An idiomatic protobuf generator for TypeScript
Apache License 2.0
2.03k stars 337 forks source link

Feature Request: grpc/grpc-web client support (in addition to @improbable-eng/grpc-web) #667

Open kkimdev opened 1 year ago

kkimdev commented 1 year ago

It seems grpc/grpc-web is more actively maintained nad has more Github Stars than @improbable-eng/grpc-web!

stephenh commented 1 year ago

Hey @kkimdev ; that sounds good to me; if you'd like to submit a PR that'd be great.

Not sure the best flag; like grpcWebImpl=improbable-eng | grpc-io.

Or maybe we should just move completely over to the grpc.io library; that would be a large breaking change, so ideally we could keep both options around.

jaqxues commented 1 year ago

Would be cool if it would support grpc/grpc-web. Especially considering that grpc-web is now in maintenance mode https://github.com/improbable-eng/grpc-web/commit/1d9bbb09a0990bdaff0e37499570dbc7d6e58ce8

flotothemoon commented 7 months ago

What would it take to implement grpc/grpc-web support @stephenh? I need this and would be happy to give it a go, but so far I don't understand how this would be implemented properly. The current grpc-web generation logic seems to be mostly in main.ts and generate-services.ts, is that right? How would what need to change to fit into the current system?

stephenh commented 7 months ago

Hi @flotothemoon ! I believe that main.ts checks for outputClientImpl=grpc-web and then calls functions that are defined in generate-grpc-web.ts for the actual grpc-web-specific output.

In terms of approach, I would probably:

As a disclaimer maybe it'd be simpler to start generate-grpc-js-web.ts as a fresh file, like if it's dramatically different from the current improbably-eng-based output, but I'm not really sure what/how much needs to change.

But that's how I'd approach it!

flotothemoon commented 6 months ago

I just found https://github.com/timostamm/protobuf-ts for generating TS types and it already integrates with grpc/grpc-web, so I'll give that a go instead for now - but thanks for the pointers, I may get back to this!