diff options
| author | stonedDiscord <stoned@derpymail.org> | 2019-07-27 18:20:59 +0200 |
|---|---|---|
| committer | stonedDiscord <stoned@derpymail.org> | 2019-07-27 18:20:59 +0200 |
| commit | 4b415fe9be83f5b5f1dafb8d9eae723a96a270ad (patch) | |
| tree | 2677fbe2b378f91ad2d75bb957a1eb95eb3761a0 /webAO/master.js | |
| parent | 49102a29cec526af10e976555effe6fa11e12202 (diff) | |
seems the ps4 has a limit on webworkers/websocket connection
so i spread them out over 1 second per server
Diffstat (limited to 'webAO/master.js')
| -rw-r--r-- | webAO/master.js | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/webAO/master.js b/webAO/master.js index 97a100a..cd5388e 100644 --- a/webAO/master.js +++ b/webAO/master.js @@ -1,5 +1,13 @@ const MASTERSERVER_IP = "master.aceattorneyonline.com:27014"; +let oldLoading = true; +export function onLoad(){ + if (!(/webOS|iPod|BlackBerry|BB|PlayBook|IEMobile|Windows Phone|Kindle|Silk|PlayStation|Opera Mini/i.test(navigator.userAgent))) { + oldLoading = false; + } +} +window.onLoad = onLoad; + const masterserver = new WebSocket("ws://" + MASTERSERVER_IP); masterserver.onopen = (evt) => onOpen(evt); masterserver.onmessage = (evt) => onMessage(evt); @@ -8,14 +16,6 @@ const descs = []; descs[99] = "This is your computer on port 27016"; const onlinec = []; -let oldLoading = false; -export function onLoad(){ - if (/webOS|iPod|BlackBerry|BB|PlayBook|IEMobile|Windows Phone|Kindle|Silk|PlayStation|Opera Mini/i.test(navigator.userAgent)) { - oldLoading = true; - } -} -window.onLoad = onLoad; - function setServ(ID) { console.log(descs[ID]); if (descs[ID] !== undefined) { @@ -83,7 +83,7 @@ function onMessage(e) { + `<a class="button" href="client.html?mode=watch&ip=${args[2]}:${args[3]}${asset}">Watch</a>` + `<a class="button" href="client.html?mode=join&ip=${args[2]}:${args[3]}${asset}">Join</a></li><br/>`; descs[i] = args[1]; - setTimeout(checkOnline(i, args[2] + ":" + args[3]), 3000); + setTimeout(checkOnline(i, args[2] + ":" + args[3]), 100); } } else if (header === "SN") { const args = msg.split("#"); @@ -95,7 +95,7 @@ function onMessage(e) { + `<a class="button" href="client.html?mode=join&ip=${args[2]}:${args[4]}">Join</a></li><br/>`; descs[i] = args[6]; masterserver.send("SR#" + i + "#%"); - setTimeout(checkOnline(i, args[2] + ":" + args[4]), 3000); + setTimeout(checkOnline(i, args[2] + ":" + args[4]), i*1000); } else if (header === "servercheok") { const args = msg.split("#").slice(1); console.log(args); |
