This commit is contained in:
2022-06-17 21:06:49 +02:00
parent 291cc2d12e
commit 9bfd6b23fc
22 changed files with 106 additions and 34 deletions

View File

@@ -50,7 +50,16 @@ $(document).ready(function(){
//$('#console').css('height', $(window).height() - $('#console').offset().top - 10);
//account for the input box
$("#console").focus();
let host = 'wss://console.brn.systems:443';
//if connection is https, then use wss://
if(window.location.protocol == "https:"){
var ws_scheme = "wss://";
}
else{
var ws_scheme = "ws://";
}
//set host to ws_scheme + hostname + port
var host = ws_scheme + window.location.hostname + ":" + window.location.port;
console.log("connecting to " + host);
var socket = io.connect(host);
resizeit();
//resize it on window resize
@@ -84,11 +93,11 @@ $(document).ready(function(){
//connect to the server
//on connect
socket.on('connect', function () {
setareacontent("Connected to server");
addareacontent("Connected to server");
});
//on disconnect
socket.on('disconnect', function () {
setareacontent("Disconnected from server");
addareacontent("Disconnected from server");
});
//on error
socket.on('error', function (err) {