tRPCttRPC
Powered by
Fouad RahebF
tRPC•3y 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
createTRPCNext
clients, it works fine in pages that don't use
useSubscription
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
useSubscription
, I'm getting this error
TRPCClientError: Subscriptions should use wsLink
TRPCClientError: Subscriptions should use wsLink
tRPCJoin
Move Fast & Break Nothing. End-to-end typesafe APIs made easy.
5,015Members
Resources
Recent Announcements

Similar Threads

Was this page helpful?

Similar Threads

tRPC context, NeonDB & WebSockets
kgniKkgni / ❓-help
2y ago
How to build the raw http request for trpc route?
daniel_montillaDdaniel_montilla / ❓-help
2y ago