diff --git a/web/frontend/src/features/chat/controller.ts b/web/frontend/src/features/chat/controller.ts index cef8b303f..c5c93d2e8 100644 --- a/web/frontend/src/features/chat/controller.ts +++ b/web/frontend/src/features/chat/controller.ts @@ -15,7 +15,6 @@ import { import { invalidateSocket, isCurrentSocket, - normalizeWsUrlForBrowser, } from "@/features/chat/websocket" import i18n from "@/i18n" import { @@ -135,7 +134,7 @@ export async function connectChat() { updateChatStore({ connectionState: "connecting" }) try { - const { token, ws_url } = await getPicoToken() + const { token } = await getPicoToken() const sessionId = activeSessionIdRef if (generation !== connectionGeneration) { @@ -151,8 +150,9 @@ export async function connectChat() { return } - const finalWsUrl = normalizeWsUrlForBrowser(ws_url) - const url = `${finalWsUrl}?session_id=${encodeURIComponent(sessionId)}` + const wsScheme = window.location.protocol === "https:" ? "wss:" : "ws:" + const wsUrl = `${wsScheme}//${window.location.host}/pico/ws` + const url = `${wsUrl}?session_id=${encodeURIComponent(sessionId)}` const socket = new WebSocket(url, [`token.${token}`]) if (generation !== connectionGeneration) {