lib/riemann/dash/public/subs.js in riemann-dash-0.2.3 vs lib/riemann/dash/public/subs.js in riemann-dash-0.2.4
- old
+ new
@@ -58,10 +58,16 @@
},
isClosed: function() { return !this.isOpen() },
url: function() {
var queryString = "query=" + encodeURI(this.query);
- return "ws://" + server + "/index?subscribe=true&" + queryString;
+ var loc = window.location, ws_uri;
+ if (loc.protocol === "https:") {
+ ws_uri = "wss://";
+ } else {
+ ws_uri = "ws://";
+ }
+ return ws_uri + server + "/index?subscribe=true&" + queryString;
},
open: function() {
if (this.isOpen()) return this;
var ws = this.ws = new WebSocket(this.url());