temporalio / sdk-typescript

Temporal TypeScript SDK
Other
523 stars 104 forks source link

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

Open Sushisource opened 3 years ago

Sushisource commented 3 years ago

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

bergundy commented 2 years ago

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

cretz commented 2 years ago

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.

bergundy commented 2 years ago

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.

nadilas commented 2 years ago

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)

cretz commented 2 years ago

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.

burakakca commented 1 year ago

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

bergundy commented 1 year ago

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