t
tRPC
trpc subscription with react-query - tRPC
K
tRPC
•
3y ago
•
2 replies
kamama
trpc subscription with react-query
TRPCClientError
: Subscriptions should use wsLink
having error when use subscription with react
-query
import
{ createTRPCReact
} from
"
@trpc
/react
-query
"
;
export const trpc
= createTRPCReact
<AppRouter
>
(
)
;
const wsClient
= createWSClient
(
{
url
:
ws://localhost:8080/ws
ws://localhost:8080/ws
,
}
)
;
const trpcClient
= trpc
.createClient
(
{
transformer
: SuperJSON
,
links
:
[
httpLink
(
{
url
:
/trpc
/trpc
,
}
)
,
wsLink
(
{
client
: wsClient
,
}
)
,
]
,
}
)
;
<trpc
.Provider client
=
{trpcClient
} queryClient
=
{queryClient
}
>
<QueryClientProvider client
=
{queryClient
}
>
<
/QueryClientProvider
>
<
/trpc
.Provider
>
tRPC
Join
Move Fast & Break Nothing. End-to-end typesafe APIs made easy.
4,951
Members
View on Discord
Resources
ModelContextProtocol
ModelContextProtocol
MCP Server
Recent Announcements
Similar Threads
Was this page helpful?
Yes
No
Similar Threads
Type mismatch with queryClient prop of @trpc/react-query
M
Madyan / ❓-help
16mo ago
Using tRPC (createCallerFactory) with react-query.
L
lunacrafts / ❓-help
2y ago
tRPC v11 with Tanstack React Query - queryOptions/mutationOptions methods missing
L
lassiter / ❓-help
8mo ago
tRPC + react query subscriptions
F
fynn / ❓-help
4mo ago