title: JavaScript Websocket only works on localhost
body: <p>Can anyone tell me how to use JavaScript to create a wss connection with a remote IP address?</p>
  
  <p>My websocket only works on <code>127.0.0.1</code> and <code>localhost</code></p>
  
  <pre><code>ws = new WebSocket("wss://127.0.0.1:13529");
  ws.onopen = function() {
    alert("连接成功");
    ws.send('tom');
    alert("给服务端发送一个字符串：tom");};
    ws.onmessage = function(e) {
    alert("收到服务端的消息：" + e.data);
  };
  </code></pre>
  
  <p>After I change 127.0.0.1 to my IP address, the connection cannot be established. </p>
  
  <p>I found a post <a href="https://stackoverflow.com/questions/12083966/why-did-i-failed-to-connect-to-websocket/12084151#12084151">Why did I failed to connect to websocket?</a>.</p>
  
  <p>It says setting '0.0.0.0' can solve this problem. However, I changed my codes as following, it cannot run. </p>
  
  <p><img src="https://i.stack.imgur.com/QW0eC.png" alt="enter image description here"></p>
  
  <p>The error message is: </p>
  
  <pre><code>Uncaught SyntaxError: Unexpected identifier
  </code></pre>
  
  <p>I also install a ssl cert:
  <a href="https://i.stack.imgur.com/SRJor.png" rel="nofollow noreferrer">install ssl cert</a></p>