title: C# WebSocketSharp.WebSocketException: Not a WebSocket handshake response
body: <p>I'd like to scrape real-time data from a website and i decided to use webSocket - sharp library. My problem is that with the same code i can parse the data from a specific website and i can't from another one.</p>
  <p><strong>The program throws this exception</strong>: WebSocket.connect:0|WebSocketSharp.WebSocketException: Not a WebSocket handshake response.</p>
  <pre><code>using (var wss = new WebSocket(&quot;wss://...&quot;))
  {
      wss.SslConfiguration.EnabledSslProtocols = System.Security.Authentication.SslProtocols.Tls12;
      wss.Origin = &quot;https://www.blabla.com&quot;;
             
      wss.CustomHeaders = new Dictionary&lt;string, string&gt;
      {
          { &quot;Accept-Encoding&quot;, &quot;gzip, deflate, br&quot; },
          { &quot;Accept-Language&quot;, &quot;el-GR,el;q=0.9,en;q=0.8&quot; },
          { &quot;Cache-Control&quot;, &quot;no-cache&quot; },
          { &quot;Connection&quot;, &quot;Upgrade&quot; },
          { &quot;Host&quot;, &quot;blabla.com&quot; },
          { &quot;Origin&quot;, &quot;https://www.bla.com&quot; },
          { &quot;Pragma&quot;, &quot;no-cache&quot; },
          //{ &quot;Sec-WebSocket-Key&quot;, secWebSocketKey },
          //{ &quot;Sec-WebSocket-Protocol&quot;, &quot;zap-protocol-v1&quot; },
          { &quot;Sec-WebSocket-Extensions&quot;, &quot;permessage-deflate; client_max_window_bits&quot; },
          { &quot;Sec-WebSocket-Version&quot;, &quot;13&quot; },
          { &quot;Upgrade&quot;, &quot;websocket&quot; },
          { &quot;User-Agent&quot;, &quot;Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.121 Safari/537.36&quot; }
       };
  
       //wss.OnOpen += Ws_OnOpen;
       wss.OnMessage += (sender, e) =&gt; Console.WriteLine($&quot;Server: {e.Data}&quot;);
       wss.OnError += (sender, e) =&gt; Console.WriteLine($&quot;Error: {e.Message}&quot;);
  
       wss.Connect();
  
       Console.ReadKey();
   }
  </code></pre>
  <p>I tried with or without custom headers.</p>
  <p>What have i do to make a valid handshake?</p>
  <p>(P.S: I can parse the data without custom headers from the first website)</p>
  <p><strong>UPDATE</strong></p>
  <p>In the URL there is a uid parameter wss://blabla.com/zap/?<strong>uid=5829062969032768</strong></p>
  <p>This uid changes in every refresh of webpage.
  I think it's necessary for the handshake. Is there any way to reproduce it?</p>