Fouad RahebF
tRPC3y ago
13 replies
Fouad Raheb

How to have 2 separate trpc clients for http and websockets?

I'm trying to have a setup where I can use trpc with 2 separate clients, one for normal HTTP requests and one for websockets since most of our site pages do not need a websocket connection.

I have tried to create 2 files with 2 different
createTRPCNext
clients, it works fine in pages that don't use useSubscription but when using it, it looks like only the first trpc client that was initialized will be used, because even if I'm using the websocket client for useSubscription, I'm getting this error TRPCClientError: Subscriptions should use wsLink
Was this page helpful?