chore: Update WebSocket provider URL handling and dependencies
Some checks failed
Tests / test (macos-latest, 3.11) (push) Has been cancelled
Tests / test (macos-latest, 3.12) (push) Has been cancelled
Tests / test (macos-latest, 3.13) (push) Has been cancelled
Tests / test (macos-latest, 3.14) (push) Has been cancelled
Tests / test (ubuntu-latest, 3.11) (push) Has been cancelled
Tests / test (ubuntu-latest, 3.12) (push) Has been cancelled
Tests / test (ubuntu-latest, 3.13) (push) Has been cancelled
Tests / test (ubuntu-latest, 3.14) (push) Has been cancelled

This commit is contained in:
2026-01-02 19:03:10 -05:00
parent 7bd6be64a4
commit 6834655e03
3 changed files with 320 additions and 282 deletions

View File

@@ -12,7 +12,8 @@ interface WebSocketContextType {
const WebSocketContext = createContext<WebSocketContextType | undefined>(undefined)
export function WebSocketProvider({ children }: { children: ReactNode }) {
const wsUrl = import.meta.env.VITE_WS_URL || 'ws://localhost:8000/ws/'
const wsProtocol = window.location.protocol === 'https:' ? 'wss:' : 'ws:';
const wsUrl = import.meta.env.VITE_WS_URL || `${wsProtocol}//${window.location.host}/ws/`;
const { isConnected, lastMessage, messageHistory, sendMessage, subscribe } = useWebSocket(wsUrl)
return (