function getBaseUrl() { var ishttps = 'https:' == document.location.protocol ? true : false; var url = window.location.host; if (ishttps) { url = 'https://' + url; } else { url = 'http://' + url; } return url; } function getWsBaseUrl() { var ishttps = 'https:' == document.location.protocol ? true : false; var url = window.location.host; if (ishttps) { url = 'wss://' + url; } else { url = 'ws://' + url; } return url; }