title: "common name invalid" for a self-signed certificate for websocket server
body: <p>I'm trying to run this <a href="https://github.com/mdn/samples-server/tree/master/s/webrtc-from-chat" rel="nofollow noreferrer">webrtc client/signaling server code</a>, but after running the server with a new self-signed certificate I created by following the instructions of <a href="https://ksearch.wordpress.com/2017/08/22/generate-and-import-a-self-signed-ssl-certificate-on-mac-osx-sierra/" rel="nofollow noreferrer">this tutorial</a>, my <code>chatclient.js</code> couldn't connect to socket server:</p>
  
  <pre><code>connection = new WebSocket('wss://localhost:6503/', 'json');
  </code></pre>
  
  <p>this is the error displayed by chrome's console: </p>
  
  <pre><code>(chatclient.js:106) WebSocket connection to 'wss://localhost:6503/' failed: 
      Error in connection establishment: net::ERR_CERT_COMMON_NAME_INVALID
  </code></pre>
  
  <p>I then go to <code>https://0.0.0.0:6503/</code> from chrome (the server is listening on port 6503), and this is the security tab from chrome inspector:</p>
  
  <p><a href="https://i.stack.imgur.com/YieN4.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/YieN4.png" alt="enter image description here"></a></p>
  
  <p>I'm guessing I need to set the correct common name during the generation of ssl certificate, to which I current set as <code>0.0.0.0:6503</code>. </p>
  
  <p>What should I set? Since this is a websocket's address and I have no idea which part to write?</p>