this.websocket = new WebSocket(url);
this.websocket.onopen = function(event) {
window.setInterval(function() { server.send(['PING']) }, 30000);
- tui.log_msg("@ server connected!");
+ tui.log_msg("@ server connected! :)");
tui.init_login();
};
+ this.websocket.onclose = function(event) {
+ tui.log_msg('@ server disconnected :(');
+ }
},
send: function(tokens) {
- if (this.websocket.readyState !== WebSocket.OPEN) {
- tui.log_msg('server disconnected :(');
- } else {
- this.websocket.send(unparser.untokenize(tokens));
- }
+ this.websocket.send(unparser.untokenize(tokens));
}
}