sdk-typescript icon indicating copy to clipboard operation
sdk-typescript copied to clipboard

[Feature Request] Enable in-browser usage of gRPC client

Open Sushisource opened this issue 3 years ago • 7 comments

Is your feature request related to a problem? Please describe.

Some users have indicated interest in being able to use the gRPC client in the browser. Enable this.

Describe the solution you'd like

Solution probably will need to leverage https://github.com/grpc/grpc-web

Additional context

Client package needs to be free of deps on not-just-proto core code

Sushisource avatar Aug 24 '21 21:08 Sushisource

We could make @temporalio/client work in the browser by replacing grpc-js with grpc-web perhaps even in the same package, e.g. https://github.com/lquixada/cross-fetch.

See related discussion here: https://temporalio.slack.com/archives/CTRCR8RBP/p1639166317413200

bergundy avatar Dec 10 '21 23:12 bergundy

Note of course that this requires server-side support, it's not a drop-in solution. May be worth looking into existing/new efforts of REST-ifying the server instead.

cretz avatar Dec 13 '21 15:12 cretz

Yes, I'm aware.

It makes a lot of sense to me to expose grpc web endpoints especially because we already have a type-safe JS client which (with minimal effort) could be used in the browser.

bergundy avatar Dec 13 '21 22:12 bergundy

Note of course that this requires server-side support, it's not a drop-in solution. May be worth looking into existing/new efforts of REST-ifying the server instead.

Not necessarily. I am currently using grpc-web from the browser via envoy-proxy, which translates the web requests for the frontend. A simple sidecar or built-in proxy could do as well (e.g. https://github.com/improbable-eng/grpc-web/tree/master/go/grpcwebproxy)

nadilas avatar Dec 16 '21 11:12 nadilas

Not necessarily. I am currently using grpc-web from the browser via envoy-proxy,

To clarify, this is what I meant by server-side support. Something must be setup on the server side currently. A built-in proxy makes plenty of sense in the Temporal server and is worth a discussion for sure.

cretz avatar Dec 16 '21 14:12 cretz

Currently it does not support working in temporal/client browser, is it true?

burakakca avatar Jul 06 '23 08:07 burakakca

We're working on an HTTP/1.1 API that can be used to back running the TS SDK client in a browser.

https://github.com/temporalio/api/pull/301

bergundy avatar Jul 06 '23 08:07 bergundy