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

compatibility with Improbable grpc-web library #65

Open
kinotto opened this issue Apr 23, 2020 · 2 comments
Open

compatibility with Improbable grpc-web library #65

kinotto opened this issue Apr 23, 2020 · 2 comments

Comments

@kinotto
Copy link

kinotto commented Apr 23, 2020

Hello,
i was wondering if you're going to add support for the Improbable grpc-web library
https://github.com/improbable-eng/grpc-web

at the moment it doesn't seem to work,

Thank you.

@rogchap
Copy link
Contributor

rogchap commented May 27, 2020

This was specifically designed for use with the official version of grpc-web
I think the improbable version uses different set of transports (fetch, websockets etc) so would be not have the same "hooks" as the official version.
There is also thoughts on using the new Client Interceptor API to provide this, but again for it to work with improbable, it would have to have the same API.

If anyone is keen to research the possibilities, open to any PRs

@jvmlet
Copy link

jvmlet commented Jun 30, 2020

Improbable supports interceptors as well as grpc-web by Google
Here is the code snippet to use interceptor with improbable :

function noopWrapTransport(t: Transport): Transport
{
    return <Transport>{
        cancel: t.cancel.bind(t),
        finishSend: t.finishSend.bind(t),
        sendMessage: t.sendMessage.bind(t),
        start:  t.start.bind(t)
    };
}

new MyServiceClient(url,
      <grpc.RpcOptions>{transport: options => noopWrapTransport(grpc.CrossBrowserHttpTransport({withCredentials: false})(options))}
                    );

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

3 participants