summaryrefslogtreecommitdiff
path: root/public/join.js
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2024-01-01 17:49:05 +0100
committerTor Andersson <tor@ccxvii.net>2024-01-01 17:50:03 +0100
commit6c537a7def09014758b022de1c42ec73ff0da5b5 (patch)
tree5b1a9b3b17a70c9d2b03a4b49101d004a5fa8a86 /public/join.js
parent8dcebc4d405bf62bc4c8d88673626b4f5df7a675 (diff)
downloadserver-6c537a7def09014758b022de1c42ec73ff0da5b5.tar.gz
Close join page event source once game has started.
And never start the event source for queued up matches.
Diffstat (limited to 'public/join.js')
-rw-r--r--public/join.js5
1 files changed, 3 insertions, 2 deletions
diff --git a/public/join.js b/public/join.js
index 089a615..27bfba0 100644
--- a/public/join.js
+++ b/public/join.js
@@ -102,7 +102,8 @@ function start_event_source() {
evtsrc.addEventListener("game", function (evt) {
console.log("GAME:", evt.data)
game = JSON.parse(evt.data)
- if (game.status > 1) {
+ if (game.status !== 0) {
+ console.log("CLOSED EVENT SOURCE")
clearInterval(timer)
evtsrc.close()
}
@@ -349,7 +350,7 @@ function update_login() {
window.onload = function () {
update()
- if (user_id && game.status < 2) {
+ if (user_id && game.status === 0 && !game.is_match) {
start_event_source()
timer = setInterval(start_event_source, 15000)
}