private void Dispose(bool disposing) { if (disposing) { CloseWebSocket(); uri = null; if (!callbackManager.IsNull()) { callbackManager.Dispose(); callbackManager = null; } if (!sendingQueue.IsNull()) { sendingQueue.Clear(); sendingQueue = null; } pinging = false; connectionOpenEvent.Reset(); connectionOpenEvent.Close(); if (!receivedQueue.IsNull()) { receivedQueue.Clear(); receivedQueue = null; } } }