One change I would do here if I understand your classes, is that the RpcTarget should be created fro

One change I would do here if I understand your classes, is that the RpcTarget should be created from the DO side, not the caller Worker side otherwise it's tied to the Worker's lifecycle. If the DO returns an RpcTarget then method calls on the RpcTarget are going to be executed in the DO itself.

For example having a method getRpcTarget() on your DO, and calling it from a Worker allows you to pass around that returned value and anyone calling it will go back to the DO.
Was this page helpful?