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.
2 Replies
wise-whiteOP•2y ago
Gist
tRPC server (running on hono with adapter) - running on Cloudflare ...
tRPC server (running on hono with adapter) - running on Cloudflare Workers - websocket connection in trpc context - context.ts
flat-fuchsia•2y ago
@kgni check my reply in #💬|general . I think it answers your question?