Persisting an RPC Client Instance Across Effect Calls
I'm building a browser SDK that opens/communicates with an RPC server within a web worker (
The worker holds onto some state and I don't want it to be destroyed/recreated between RPC calls.
This means I need to instantiate and keep the RPC client alive / avoid its finalizers from closing the port.
Is there a good way to do something like the following, wherein
Perhaps something similar to what we see from
RpcClient.layerProtocolWorker).The worker holds onto some state and I don't want it to be destroyed/recreated between RPC calls.
This means I need to instantiate and keep the RPC client alive / avoid its finalizers from closing the port.
Is there a good way to do something like the following, wherein
MyRpcClient exists outside of the context of the Effect / subsequent calls of someLibraryMethod access that same MyRpcClient instance?Perhaps something similar to what we see from
Atom.keepAlive in @effect-atom/atom-react?