Dynamically generate WebSocket URLs based on current domain to support both HTTP and HTTPS environments.
All checks were successful
Dynamic Branch Deploy / build-and-deploy (push) Successful in 2m24s
All checks were successful
Dynamic Branch Deploy / build-and-deploy (push) Successful in 2m24s
This commit is contained in:
@@ -136,7 +136,12 @@ function connectLeaderboardWebSocket() {
|
||||
return; // Already connected
|
||||
}
|
||||
|
||||
const wsURL = 'ws://localhost:8080/ws';
|
||||
// Automatisch die richtige WebSocket-URL basierend auf der aktuellen Domain
|
||||
const protocol = window.location.protocol === 'https:' ? 'wss:' : 'ws:';
|
||||
const host = window.location.host;
|
||||
const wsURL = `${protocol}//${host}/ws`;
|
||||
|
||||
console.log('🔌 Verbinde zu WebSocket:', wsURL);
|
||||
leaderboardWS = new WebSocket(wsURL);
|
||||
|
||||
leaderboardWS.onopen = () => {
|
||||
|
||||
Reference in New Issue
Block a user