Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make use of grpc-web interceptor #68

Open
jvmlet opened this issue Jun 30, 2020 · 8 comments
Open

Make use of grpc-web interceptor #68

jvmlet opened this issue Jun 30, 2020 · 8 comments

Comments

@jvmlet
Copy link

jvmlet commented Jun 30, 2020

Now, when grpc-web officially supports interceptors , would be great to see this extension uses them.

@jvmlet
Copy link
Author

jvmlet commented Jun 30, 2020

BTW, improbable also supports interceptors, so all users might benefit from this great dev tool.

@rogchap
Copy link
Contributor

rogchap commented Aug 1, 2020

Yea; this is something that I would like to get to doing at some point. Happy for PRs if someone has the time to look into this?

@jrapoport
Copy link

pull request for interceptors #79

@jrapoport
Copy link

merged this change into my fork's master and updated the readme to reflect the change. I'm dropping a link here for anyone that finds this and wants to use native gRPC-Web interceptors:
https://github.com/jrapoport/grpc-web-devtools

@caseylucas
Copy link

@jrapoport So does your version work with https://github.com/improbable-eng/grpc-web? If so, do you need to do anything to make sure that the browser has a specific version of devtools (which supports one client library over the other) installed?

@jrapoport
Copy link

jrapoport commented Mar 10, 2021

no clue. it was written for https://github.com/grpc/grpc-web interceptors. the version i wrote isn't published so you have to install manually and disable other versions.

it might work with improbable interceptors if they are functionally the same, but i've never tried it.

@gebv
Copy link

gebv commented Mar 9, 2023

The following code works for me for improbable-eng

import { grpc } from '@improbable-eng/grpc-web'

...

grpc.unary(methodDescriptor, {
        request: request,
        host: backendURL,
        metadata: new grpc.Metadata(metadata),
        onEnd: res => {
          const { status, statusMessage, headers, message, trailers } = res

          window.postMessage({
            type: '__GRPCWEB_DEVTOOLS__',
            method: methodDescriptor.service.serviceName + '/' + methodDescriptor.methodName,
            methodType: 'unary',
            request: request.toObject(),
            response: message.toObject(),
          }, '*')
       }
    }
 )   

@nibres
Copy link

nibres commented Mar 11, 2023

Created this PR with several lines of code to fix this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants