using the host from the document.location

This commit is contained in:
Martin Donnelly 2016-11-23 20:41:22 +00:00
parent 126a3d585b
commit 4cf040a866

View File

@ -3,14 +3,16 @@ const WEBSOCKET = function (model) {
const useUrl = 0;
let wsUrl = ['localhost', 'silvrtree.co.uk'];
const wsPort = '3010';
console.log(document.location);
if ('https:' === document.location.protocol) {
wsUrl = 'wss://' + wsUrl[useUrl] + '';
// wsUrl = 'wss://' + wsUrl[useUrl] + '';
wsUrl = 'wss://' + document.location.host ;
// wsPort = '';
} else {
//wsUrl = 'ws://localhost:3001';
wsUrl = 'ws://' + wsUrl[useUrl] + '';
// wsUrl = 'ws://' + wsUrl[useUrl] + '';
// wsPort = '';
wsUrl = 'ws://' + document.location.host ;
}