Durable Object to Durable Object Communication

Hello, I’m trying to get Durable Objects to talk to each other. While I’m successful in doing so using the fetch method, it’s really verbose for a lot of simple internal storage.put operations.

It seems natural to add a method to my DO for this purpose, but I’m getting the error after I use .get(id).test(...):

test is not a function

Is there a better way to communicate quickly and easily between DOs vs. using fetch?

Gonna tag @gmckeon since he seems to be resident DO expert :grin:

Hey,

The Cloudflare workers discord is also a great source of knowledge for this stuff :slight_smile:

Feel free to join at Cloudflare Workers

Hope to see you there!

Hey! You might be interested in something like itty-durable. We don’t currently support an RPC interface or a simpler way to communicate with your object besides calling fetch().

Nice package. I like the approach and class inheritance approach keeping the code clean.

I’ve already done something similar but basically just with 3 functions that boilerplate the constructor, internalFetch, parseArgs (inside fetch).

I think my approach will shave off some ms and also it doesn’t stray from the DO spec too much i.e. you’re still looking at the DO spec class + helper methods vs. an abstraction.

I’ve already shot myself in the foot a few times coding DOs so I don’t want to abstract away things and find out I’ve limited/created error prone code.

Thanks for your quick response @gmckeon I will also join Cloudflare Workers Discord @powelljl thanks!