brumbrum_brum
brumbrum_brum3w ago

Cloudflare worker subscriptions/websockets

Does anyone have any experience setting up CF Workers with TRPC supbscriptions, in a way where I can have both subscriptions and mutation/queries at the same time? Also without the use of durable objects.
4 Replies
BeBoRE
BeBoRE3w ago
Pretty sure the fetch api handler works fine https://trpc.io/docs/server/adapters/fetch As you stated it doesn’t use durable objects, so that could increase costs.
Fetch / Edge Runtimes Adapter | tRPC
You can create a tRPC server within any edge runtime that follow the WinterCG, specifically the Minimum Common Web Platform API specification.
brumbrum_brum
brumbrum_brumOP3w ago
Does not using durable objects increase cost?
BeBoRE
BeBoRE3w ago
Yeah, not using hibernation could increase costs especially, but at lower scales I wouldn't worry about it. Good thing about the fetch adapter is that you can switch to a different service pretty easily, so you aren't that vendor locked. As long as you monitor your spending and know where your expenses are coming from you should be good.
brumbrum_brum
brumbrum_brumOP3w ago
Huh okay, I will look into that, thank you!