$(function() {
  var socket = new WebSocket("ws://localhost:3001/");

  socket.onmessage = function(message){
    console.log('got a message: ')
    console.log(message)
  }

});

$(function() {
  var socket = new WebSocket("ws://" + window.location.host + "/");

  socket.onmessage = function(message){
    console.log('got a message: ')
    console.log(message)
  }

});

Use a host-relative URL for the websocket
Use a host-relative URL for the websocket
