fix(web,api): fix WebSocket authentication for chat real-time connection (#547)
Some checks failed
ci/woodpecker/push/web Pipeline failed
ci/woodpecker/push/api Pipeline was successful

Co-authored-by: Jason Woltje <jason@diversecanvas.com>
Co-committed-by: Jason Woltje <jason@diversecanvas.com>
This commit was merged in pull request #547.
This commit is contained in:
2026-02-27 11:30:44 +00:00
committed by jason.woltje
parent 6ac63fe755
commit c0e679ab7c
3 changed files with 68 additions and 3 deletions

View File

@@ -89,7 +89,11 @@ export const Chat = forwardRef<ChatRef, ChatProps>(function Chat(
...(initialProjectId !== undefined && { projectId: initialProjectId }),
});
const { isConnected: isWsConnected } = useWebSocket(user?.id ?? "", "", {});
// Use the actual workspace ID for the WebSocket room subscription.
// Cookie-based auth (withCredentials) handles authentication, so no explicit
// token is needed here — pass an empty string as the token placeholder.
const workspaceId = user?.currentWorkspaceId ?? user?.workspaceId ?? "";
const { isConnected: isWsConnected } = useWebSocket(workspaceId, "", {});
const { isCommand, executeCommand } = useOrchestratorCommands();