tRPC context, NeonDB & WebSockets
Hi there!
I'm currently working on a serverless app with the following tech stack:
Cloudflare Workers, Hono, tRPC, DrizzleORM & NeonDB.
I'm trying to create 2 Neon client instances (using DrizzleORM) on my tRPC server that is running on Cloudflare Workers.
1 for HTTP
1 for WebSockets (this is used for transactions)
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 db client in my procedure?
I made this gist with the files I have currently
I'm currently working on a serverless app with the following tech stack:
Cloudflare Workers, Hono, tRPC, DrizzleORM & NeonDB.
I'm trying to create 2 Neon client instances (using DrizzleORM) on my tRPC server that is running on Cloudflare Workers.
1 for HTTP
1 for WebSockets (this is used for transactions)
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 db client in my procedure?
I made this gist with the files I have currently
Gist
tRPC server (running on hono with adapter) - running on Cloudflare Workers - websocket connection in trpc context - context.ts
