diff --git a/frontend/src/views/HostView.vue b/frontend/src/views/HostView.vue index ff91ada..efb491b 100644 --- a/frontend/src/views/HostView.vue +++ b/frontend/src/views/HostView.vue @@ -123,7 +123,9 @@ setInterval(() => { }, 100) function createSession() { - store.connect(`ws://${window.location.hostname}:8000/ws/host`) + const proto = window.location.protocol === 'https:' ? 'wss:' : 'ws:' + const port = window.location.port + store.connect(`${proto}//${window.location.hostname}:${port}/ws/host`) store.ws.onopen = () => { const quiz = yaml.load(yamlInput.value) store.send({ action: 'CREATE_SESSION', quiz }) diff --git a/frontend/src/views/PlayView.vue b/frontend/src/views/PlayView.vue index 19b4dc8..e892407 100644 --- a/frontend/src/views/PlayView.vue +++ b/frontend/src/views/PlayView.vue @@ -77,7 +77,11 @@ const myScore = computed(() => { }) function joinGame() { - store.connect(`ws://${window.location.hostname}:8000/ws/play/${code.value}/${name.value}`) + const proto = window.location.protocol === 'https:' ? 'wss:' : 'ws:' + const port = window.location.port + store.connect( + `${proto}://${window.location.hostname}:${port}/ws/play/${code.value}/${name.value}`, + ) store.ws.onopen = () => { joined.value = true // If we join mid-game, this ensures we see the right state