From 144e23ce9ef18e313b710c309a899da41c5191f0 Mon Sep 17 00:00:00 2001 From: anatoly techtonik Date: Sun, 14 Dec 2014 00:59:34 +0300 Subject: [PATCH] Use secure websockets over HTTPS (fixes issue #24) --- treema.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/treema.js b/treema.js index e017f60..a36b4ba 100644 --- a/treema.js +++ b/treema.js @@ -28,9 +28,10 @@ }; var port = ar.port || 9485; var host = br.server || window.location.hostname; + var protocol = (window.location.protocol == 'http') ? 'ws' : 'wss'; var connect = function(){ - var connection = new WebSocket('ws://' + host + ':' + port); + var connection = new WebSocket(protocol + '://' + host + ':' + port); connection.onmessage = function(event){ if (ar.disabled) return; var message = event.data; @@ -4086,4 +4087,4 @@ TreemaUtils = (function() { } })(); ; -//# sourceMappingURL=treema.js.map \ No newline at end of file +//# sourceMappingURL=treema.js.map