title: How to handle WebSocket client events
body: <p>I need to handle the State events from this WebSocket client (<code>ReadyState</code>), but I get an error when implementing the <code>EventHandler</code>, not sure what I'm doing wrong.</p>
  <p>The error I get is:</p>
  <blockquote>
  <p>Operator '+=' cannot be applied to operands of type 'WebSocketSharp.WebSocketState' and 'System.EventHandler'</p>
  </blockquote>
  <p>Here is how I'm trying to implement the eventhandler:</p>
  <pre class="lang-cs prettyprint-override"><code>this.ws.ReadyState += new EventHandler(webSocketClient_StatusChange);
  </code></pre>
  <p>Here is the code:</p>
  <pre class="lang-cs prettyprint-override"><code>WebSocket ws;
  
  public Form1()
  {
      InitializeComponent();
      this.ws.ReadyState += new EventHandler(webSocketClient_StatusChange);
  }
  
  private void webSocketClient_StatusChange(object sender, EventArgs e)
  {
      MessageBox.Show(&quot;WebSocket Status Changed...&quot;);
  }
  
  public void webSocketClientConnection()
  {
      ws = new WebSocket(&quot;ws://&quot;192.168.1.165&quot;:1258&quot;);
  
      {
          ws.OnMessage += (sender, e) =&gt;
              {
                  string value = (e.Data);
               // More code goes here
              };
  
          ws.Connect();
          ws.Send(&quot;Welcome message&quot;);
      }
  }
  </code></pre>