Browse Source

Do not connect to web socket until after page load

pull/54/head
Amir Sanni 5 years ago
parent
commit
93a7b20b32
  1. 18
      js/comm.js

18
js/comm.js

@ -20,15 +20,23 @@ let wsChat; @@ -20,15 +20,23 @@ let wsChat;
const room = getRoom();
if(location.protocol === 'http:'){
window.addEventListener('load', function(){
if(location.protocol === 'http:'){
wsChat = new WebSocket("ws://localhost:8080/comm");
}
}
else{
else{
wsChat = new WebSocket("wss://localhost:8080/comm");
}
}
/*
********************************************************************************************************************************
********************************************************************************************************************************
********************************************************************************************************************************
********************************************************************************************************************************
********************************************************************************************************************************
*/
window.addEventListener('load', function(){
//startCounter();//shows the time spent in room
/*

Loading…
Cancel
Save