From c7955ecee74d4a9aa9adc34147397131e44c5bad Mon Sep 17 00:00:00 2001 From: emil28092005 Date: Fri, 16 Jan 2026 20:31:39 +0300 Subject: [PATCH] Fix WebSocket connection. --- docker-compose-jenkins.yml | 2 -- static/js/chat.js | 6 +++--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/docker-compose-jenkins.yml b/docker-compose-jenkins.yml index b88a9cb..33812ea 100644 --- a/docker-compose-jenkins.yml +++ b/docker-compose-jenkins.yml @@ -1,5 +1,3 @@ -version: '3.8' - services: jenkins: image: jenkins/jenkins:lts-jdk17 diff --git a/static/js/chat.js b/static/js/chat.js index a96a1e1..621cca1 100644 --- a/static/js/chat.js +++ b/static/js/chat.js @@ -23,12 +23,12 @@ function loadRooms() { function connectRoom() { const room = roomSelect.value || 'general'; const protocol = window.location.protocol === 'https:' ? 'wss:' : 'ws:'; - + const host = window.location.host; if (ws) { ws.close(); } - - ws = new WebSocket(`${protocol}//localhost:8080/ws/${room}`); + const wsUrl = `${protocol}//${host}/ws/${room}`; + ws = new WebSocket(wsUrl);