Websocket: apparently this needs to be the full URL

This commit is contained in:
2025-03-05 00:19:38 -08:00
parent 2b533cf1db
commit 9303c5acfe

View File

@@ -180,7 +180,9 @@ const App: React.FC = () => {
} }
}, [fetchPlaylist, fetchNowPlaying, fetchFavorites]); }, [fetchPlaylist, fetchNowPlaying, fetchFavorites]);
useWebSocket('/api/events', { const wsUrl = `${window.location.protocol === 'https:' ? 'wss:' : 'ws:'}//${window.location.host}/api/events`;
console.log('Connecting to WebSocket at', wsUrl);
useWebSocket(wsUrl, {
onOpen: () => { onOpen: () => {
console.log('WebSocket connected'); console.log('WebSocket connected');
}, },