Browse Source

Do not connect to web socket until after page load

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

22
js/comm.js

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

Loading…
Cancel
Save