this.url = url;
this.websocket = new WebSocket(this.url);
this.websocket.onopen = function(event) {
- server.connected = true;
game.thing_types = {};
game.terrains = {};
server.send(['TASKS']);
tui.switch_mode('login');
};
this.websocket.onclose = function(event) {
- server.connected = false;
tui.switch_mode('waiting_for_server');
tui.log_msg("@ server disconnected :(");
};
}, false);
}
window.setInterval(function() {
- if (server.connected) {
+ if (server.websocket.readyState == 1) {
server.send(['PING']);
} else {
server.reconnect_to(server.url);
tui.log_msg('@ attempting reconnect …')
}
-}, 5000);
+}, 1000);
window.setInterval(function() {
let val = "?";
let span_decoration = "none";