used websocket protocol should match the http one

This commit is contained in:
Gonçalo Valério 2019-01-27 13:04:19 +00:00
parent b16b2a738c
commit 789ef35bb7
1 changed files with 2 additions and 1 deletions

View File

@ -20,9 +20,10 @@ function setupConnection() {
Setup a connection to receive all the information
about the webhooks in real-time.
*/
let protocol = document.location.protocol == "https:" ? "wss://" : "ws://";
let callbackCode = getCallbackCode();
let webhookSocket = new WebSocket(
"ws://" + window.location.host + "/ws/callback/" + callbackCode + "/"
protocol + window.location.host + "/ws/callback/" + callbackCode + "/"
);
webhookSocket.onmessage = function(event) {