NeonN
Neon2y ago
2 replies
improved-purple

tRPC context, serverless-driver & websockets

Hi there!

I'm currently working on a serverless app with the following tech stack:

CF Workers, Hono, tRPC, DrizzleORM & Neon.


I'm trying to create 2 Neon client instances (using DrizzleORM) in a tRPC server that is running on Cloudflare workers. 1 HTTP - 1 WebSockets.

I'm a bit confused as to when the WebSocket connection will open.

Currently I'm creating both db client instances in the tRPC context (using the Hono tRPC adapter) - so will a WebSocket connection open every single time a procedure runs, or only when I'm actually accessing and using the WebSocket client in my procedure?

Sorry if this question is too tRPC related - feel free to take the post down if that is the case.
Was this page helpful?