From 506331c51bb3d44bf811fe473ae2bf4c134ee023 Mon Sep 17 00:00:00 2001 From: Amir Sanni Date: Mon, 13 May 2019 16:16:56 +0100 Subject: [PATCH] Add auto-detect of page protocol --- js/comm.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/js/comm.js b/js/comm.js index 6396cf5..20a86a5 100644 --- a/js/comm.js +++ b/js/comm.js @@ -18,9 +18,17 @@ var myPC; var awaitingResponse; var streamConstraints; var myMediaStream; +let wsChat; const room = getRoom(); -const wsChat = new WebSocket("ws://localhost:8080/comm"); + +if(location.protocol === 'http:'){ + wsChat = new WebSocket("ws://1410inc.xyz:8080/comm"); +} + +else{ + wsChat = new WebSocket("wss://1410inc.xyz:8080/wss2/comm"); +} window.addEventListener('load', function(){ startCounter();//shows the time spent in room