Skip to content

Commit

Permalink
Merge pull request #112 from sjanuary/wss
Browse files Browse the repository at this point in the history
Support wss in dashboard
  • Loading branch information
tobespc authored May 3, 2017
2 parents 1eced1a + 572139d commit 19c62a4
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -95,15 +95,17 @@
<script type="text/javascript" src="js/memChart.js"></script>
<script>
var myurl = location.host;
var client = new WebSocket("ws://" + myurl + "/swiftmetrics-dash","swiftmetrics-dash")
var webSocketProtocol = "ws://"
if(location.protocol === "https:") {
webSocketProtocol = "wss://"
}
var client = new WebSocket(webSocketProtocol + myurl + "/swiftmetrics-dash","swiftmetrics-dash")

client.onmessage = function(message) {
received = JSON.parse(message.data);
topic = received.topic;
payload = JSON.stringify(received.payload);


console.log(topic);
switch (topic) {
case 'cpu':
updateCPUData(payload);
Expand Down

0 comments on commit 19c62a4

Please sign in to comment.