From dfffb54d6c96200d7ff3098f303b2780bd16198b Mon Sep 17 00:00:00 2001 From: Andreas Hultgren Date: Thu, 16 Apr 2015 15:23:00 +0200 Subject: [PATCH] Support web sockets over wss --- source/js/main.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source/js/main.js b/source/js/main.js index f3f80bb..ea09fb8 100644 --- a/source/js/main.js +++ b/source/js/main.js @@ -3,7 +3,8 @@ var thematrix = require('./thematrix'); var blips = require('./blips'); var port = document.location.port ? ':' + document.location.port : ''; -var socket = new WebSocket(`ws://${document.location.hostname}${port}`); +var scheme = document.location.protocol === 'http:' ? 'ws:' : 'wss:'; +var socket = new WebSocket(`${scheme}//${document.location.hostname}${port}`); var allowedMessages = ['LoadArticle', 'pageview', 'articleseen']; socket.onmessage = (e) => {