diff --git a/bun.lockb b/bun.lockb index 87eb5c2..fdb4d75 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/packages/webui/package.json b/packages/webui/package.json index a085bb6..6208941 100644 --- a/packages/webui/package.json +++ b/packages/webui/package.json @@ -18,7 +18,8 @@ "mobx": "^6.13.0", "mobx-react-lite": "^4.0.7", "react": "^18.3.1", - "react-dom": "^18.3.1" + "react-dom": "^18.3.1", + "ws": "^8.18.0" }, "devDependencies": { "@todo-tests/common": "workspace:*", diff --git a/packages/webui/src/trpc/TRPCClientProvider.tsx b/packages/webui/src/trpc/TRPCClientProvider.tsx index d562f2b..ff0459c 100644 --- a/packages/webui/src/trpc/TRPCClientProvider.tsx +++ b/packages/webui/src/trpc/TRPCClientProvider.tsx @@ -1,5 +1,5 @@ import { QueryClient, QueryClientProvider } from "@tanstack/react-query" -import { httpBatchLink } from "@trpc/client" +import { createWSClient, wsLink } from "@trpc/client" import { ReactNode, useState } from "react" import { trpc } from "./trpc" @@ -12,13 +12,16 @@ export interface TRPCClientProviderProps { export function TRPCClientProvider({ children }: TRPCClientProviderProps) { const [queryClient] = useState(new QueryClient()) + const [wsClient] = useState(createWSClient({ url: "ws://localhost:3001" })) const [trpcClient] = useState(trpc.createClient({ links: [ - httpBatchLink({ - url: "http://localhost:8080/rpc", - headers: async () => ({}), - }) + // httpBatchLink({ + // url: "http://localhost:8080/rpc", + // headers: async () => ({}), + // }), + + wsLink({ client: wsClient }), ] }))