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

[Feature Request] Support using the pure JS `Connection` to power a `Worker`

Open bergundy opened this issue 2 years ago • 0 comments

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

Currently the SDK has two separate connection classes:

  1. NativeConnection which is a JS representation of the Rust client object used to power workers.
  2. Connection a grpc-js backed object that can only be used to power clients.

This is unnecessarily confusing and is blocking adding features such as:

  1. exposing the worker's connection to activity implementations.
  2. eager workflow start.

Describe the solution you'd like

Merge the two classes.

Connection is the preferred implementation as it supports grpc interceptors and does not require any native code making it slimmer and better suited for client applications especially in FaaS platforms where the native code what increase the function size and increase cold start times. Abstracting the Rust client trait takes us a step forward towards compiling Rust Core to WASM, which opens up supporting other JS runtimes with great ease.

Additional context

Note that the Connection class does not record any metrics, that is a prerequisite for this issue.

bergundy avatar Nov 20 '23 20:11 bergundy