feat(grpc-web): make public some methods to enable grpc-web client proxying
Motivation
I want to create a middleware grpc service that can listen to regular grpc calls, and forward them to another service as grpc-web calls. In order to do this fully generically, there needs to be made public some internals of tonic that are normally called via the Grpc service that the generated service code uses.
Solution
Publish the minimal set of symbols that are required
If there is interest, I can create a new example in the examples dir to demonstrate grpc-web proxying. I've only tested unary calls locally so far.
relates to #31 but doesn't necessarily close it. update: it probably does close that issue as I've used this branch for both grpc-web and IPC handling for my project with success
Marked as ready for review, but note it is not ready for merge as it needs docs on the newly public interfaces and possible an example of use. Just want to make sure the concept is sound before I put further effort in.
I think these changes are okay (once CI passes), but would be interested in feedback from @tottoto.
Looks good to me too.
If there is interest, I can create a new example in the examples dir to demonstrate grpc-web proxying. I've only tested unary calls locally so far.
I would think it would be helpful. Would appreciate your suggestion, but we need to see the actual example to consider whether to add it.
@tottoto thanks for the review, I've fixed up the CI with some docs, and added a new example demonstrating a super basic proxy that just passes a request on. Of course my real world proxy does more things like grpc-web translation but I wanted to keep it smallish.
I don't think we want to add yet another example here. Would be good to get the documentation additions squashed into the initial commit, though.
@djc I understand the resistance to the proliferation of too many examples though since this one touches these newly public api do you reckon I'd be better of reformulating the example as an integration test?
For now, I've dropped the example from this PR entirely so we can get this in and continue discussion in another PR if that's a preferred option?
I think the remaining CI failure is fixed by #1906
@tottoto any chance you could have another look at this PR? Thanks!