Subscription error: TRPCClientError: Subscriptions should use wsLink
this is my trpc client:
I don't know what is the issue exactly.
14 Replies
anyone help please? im stuck and I dont know what shopuld I do here, heres a stackoverflow explaination of my issue
https://stackoverflow.com/questions/78653455/error-subscriptions-should-use-wslink-using-trpc
Stack Overflow
Error "Subscriptions should use wsLink" using tRPC
While trying to implement subscriptions with tRPC, I encountered this issue, that it should use wsLink, even though, it is implemented in the trpc client.
I get this error when trying to use random...
This example and the stack overflow are different, the example here should work
it doesn't actually I am not sure where I am wrong
here is a detailed vers:
when i console log i get this err :
![No description](https://cdn.answeroverflow.com/1257707954879332404/Screenshot_2024-07-02_at_15.42.12.png)
Yeah idk, looking at the example the code should work in the browser. Is there a ws connection being made?
sorry i dont understand ur qst
@Alex / KATT π± any ideas pleasse?
been stuck on this for quite sometime
HTTP Subscription Link | tRPC
httpSubscriptionLink is a terminating link that's uses Server-sent Events (SSE) for subscriptions.
Module '"@trpc/client"' has no exported member 'unstable_httpSubscriptionLink'.ts(2305)
@Alex / KATT π± what to do here?Use the Next branch if you want to use that. I donβt think itβll solve your issue, because it will still be attempting to use your htthBatchLink for subscriptions somewhere
if you mean this, I've already added it, but still doesn't get imported
![No description](https://cdn.answeroverflow.com/1257778595854811269/Screenshot_2024-07-02_at_20.22.34.png)
npm install @trpc/server@next @trpc/client@next @trpc/react-query@next @trpc/next@next @tanstack/react-query@latest @tanstack/react-query-devtools@latest
I have a question, @Alex / KATT π± the subscription works when only I replace wsLink(...) with
unstable_httpSubscriptionLink
why is that?
in the client provideryou don't use websockets
so something is prob wrong with your server setup
just kill all your websocket server stuff and use the httpSubscriptionLink
HTTP Subscription Link | tRPC
httpSubscriptionLink is a terminating link that's uses Server-sent Events (SSE) for subscriptions.