private void WebSocketOnClose(object sender, CloseEventArgs e) { _connected = false; if (OnClosed != null) { OnClosed(e.Code, e.Reason); } _toSend.Enqueue(null); }