aboutsummaryrefslogtreecommitdiff
path: root/webAO
diff options
context:
space:
mode:
authorsD <stoned@derpymail.org>2019-12-19 12:41:22 +0100
committersD <stoned@derpymail.org>2019-12-19 12:41:22 +0100
commit7169a80cf4e68ae06069cfb2bfbcd003b3a892fd (patch)
treee483685b4aec04ee23156e18269d2f9e39dc4c68 /webAO
parent3ea54b16038108db524de1729a8eceeb9a8ae487 (diff)
change localhost port to 50001 and ID to -1
Diffstat (limited to 'webAO')
-rw-r--r--webAO/index.html7
-rw-r--r--webAO/master.js11
2 files changed, 14 insertions, 4 deletions
diff --git a/webAO/index.html b/webAO/index.html
index 05afdf6..28fe555 100644
--- a/webAO/index.html
+++ b/webAO/index.html
@@ -68,9 +68,10 @@
</p>
</div>
<ul class="serverlist" id="masterlist">
- <li onmouseover="setServ(99)">
- <p>Localhost</p> <a class="button" href="client.html?ip=127.0.0.1:27016">Watch</a><a class="button" href="client.html?ip=127.0.0.1:27016">Join</a></li>
-
+ <li id="server-1" class="unavailable" onmouseover="setServ(-1)"><p>Localhost</p>
+ <a class="button" href="client.html?mode=watch&ip=127.0.0.1:50001">Watch</a>
+ <a class="button" href="client.html?mode=join&ip=127.0.0.1:50001">Join</a>
+ </li>
</ul>
</div>
</body>
diff --git a/webAO/master.js b/webAO/master.js
index 8637291..608cc29 100644
--- a/webAO/master.js
+++ b/webAO/master.js
@@ -25,7 +25,7 @@ masterserver.onopen = (evt) => onOpen(evt);
masterserver.onmessage = (evt) => onMessage(evt);
const server_description = [];
-server_description[99] = "This is your computer on port 27016";
+server_description[-1] = "This is your computer on port 50001";
const online_counter = [];
export function setServ(ID) {
@@ -72,6 +72,10 @@ async function checkOnline(serverID, coIP) {
}
}
+ function onCOError(_e) {
+ console.warn(serverID + " threw an error.");
+ }
+
var oserv = new WebSocket("ws://" + coIP);
oserv.onopen = function (evt) {
@@ -82,6 +86,10 @@ async function checkOnline(serverID, coIP) {
onCOMessage(evt);
};
+ oserv.onerror = function(evt) {
+ onCOError(evt)
+ };
+
}
function onMessage(e) {
@@ -103,6 +111,7 @@ function onMessage(e) {
server_description[i] = args[1];
checkOnline(i, `${args[2]}:${args[3]}`);
}
+ checkOnline(-1, "127.0.0.1:50001");
}
else if (header === "SN") {
const args = msg.split("#");