title: Websocket server not getting a handshake when ws:// changed to wss://
body: <p>We are completely stuck and would love help from someone who has worked on WSS and knows some cloud infrastructure.</p>
  
  <p>We built a custom websocket server in a style similar to <a href="https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API/Writing_WebSocket_server" rel="nofollow">this</a>. The server is run on a VM in Azure on port 45001. The client is our website (HTML/Javascript). The websocket uri is 'ws://endpointname:45001' The server would get a handshake request and send the appropriate response and a connection was established. The client and server communicated happily every after!</p>
  
  <p>The moment we installed an SSL certificate where our website is hosted on Azure, the browser asked us to convert ws calls wss://. By doing this, the first message that was hitting the server port that was an HTTP upgrade request is now some encrypted message that server can’t make sense of!!! </p>
  
  <pre><code>//Used to convert the first messages to string. The string used to be the handshake request
  //But when connected via wss, this string is meaningless gibberish.
  
  String data = Encoding.UTF8.GetString(bytes); 
  </code></pre>
  
  <p>Any ideas why the server VM is not getting an HTTP upgrade request?  </p>
  
  <p>Things we tried:</p>
  
  <ol>
  <li>Installed the certificate on port 45001 of the VM. No luck. Not sure how the VM would even know to use this cert to decrypt.</li>
  <li>Ran the server locally and let the browser connect via wss. The server still got weird encrypted messages. In the local environnment, on what basis does </li>
  </ol>
  
  <p>Would really appreciate if someone can help.!!! </p>