title: Get Data from WebSocket using .Net ClientWebSocket
body: <p>I need to collect data from a WebSocket.</p>
  
  <p>If I try to test the websocket with this site: <a href="http://www.websocket.org/echo.html" rel="nofollow noreferrer">http://www.websocket.org/echo.html</a> I can connect and send message without problem but when I try to connect to the websocket using .Net Framework libraries I get:</p>
  
  <p>System.Net.WebException: Internal Server Error (500).</p>
  
  <p>The code I use to connect is this:</p>
  
  <pre><code>        string uri = "wss://wss.xxx.xxx";
          ClientWebSocket webSocket = null;
          try
          {
              webSocket = new ClientWebSocket();
              await webSocket.ConnectAsync(new Uri(uri), CancellationToken.None);
              await Task.WhenAll(Receive(webSocket), Send(webSocket));
          }
          catch (Exception ex)
          {
              Console.WriteLine("Exception: {0}", ex);
          }
  </code></pre>
  
  <p>If I try to connect to any other web socket, the code works well...</p>
  
  <p>The difference with the other websocket is that the address starts with "<strong>wss</strong>" instead of "<strong>ws</strong>" ( think its because of secure connection).</p>
  
  <p>If I test with a browser like Chrome the websocket connetion works, but not in .Net, may be I have to add some header in order to simulate a Browser Agent ?</p>
  
  <p>Thanks to support</p>