Skip to content

Commit

Permalink
Convert socket protocol into ternary expression
Browse files Browse the repository at this point in the history
  • Loading branch information
shippy committed Nov 27, 2017
1 parent c85f2b5 commit 8bf4b28
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions mesa/visualization/templates/js/runcontrol.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,10 @@ var fpsControl = $('#fps').slider({
var sidebar = $("#sidebar");

// WebSocket Stuff
// Support TLS-specific URLs, when appropriate
if (window.location.protocol == "https:") {
var ws_scheme = "wss://";
} else {
var ws_scheme = "ws://"
};

// Open the websocket connection; support TLS-specific URLs when appropriate
var ws = new WebSocket((window.location.protocol == "https:" ? "wss://" : "ws://") +
location.host + "/ws");

var ws = new WebSocket(ws_scheme + location.host + "/ws"); // Open the websocket connection
ws.onopen = function() {
console.log("Connection opened!");
send({"type": "get_params"}); // Request model parameters when websocket is ready
Expand Down

0 comments on commit 8bf4b28

Please sign in to comment.