grpc-web-devtools icon indicating copy to clipboard operation
grpc-web-devtools copied to clipboard

Registering requests / responses (postMessage) as callable API

Open smnbbrv opened this issue 4 years ago • 1 comments

Hi @rogchap

I work on a custom gRPC code generator plugin and due to a different data structure I have problems connecting it to this amazing extension. My idea is to have the interceptor which would simply push the messages via your API.

That's why I'd love to have this (and similar for streaming) calls

https://github.com/SafetyCulture/grpc-web-devtools/blob/4248fb4c092fa9b788b4e8964b453fe64bfb12c9/public/content-script.js#L73

as some sort of fixed API.

Of course I can call postMessage directly and use your data structure, but, as long as it is not anyhow documented I am unsure of its stability.

This by the way could potentially solve this issue #35 as well. The RPC calls there are done in a worker thread, however they could simply post the messages to the window and redirect them there to your API.

Would this be possible?

smnbbrv avatar Nov 14 '19 14:11 smnbbrv

Hey @smnbbrv thanks for the suggestion; sorry it took me so long to get to this. When I wrote this extension I wanted to use client interceptors (hence why I wrote the proposal on gRPC-web); so without it I had to “hook-in” by overriding the generated API. I’ll take a closer look at your Angular fix/PR and see what we can do. Not sure when, so if you happen to submit a PR, I’m more than happy to review 😃

rogchap avatar Dec 06 '19 20:12 rogchap