As suggested by @steveluscher, switched the nil-ing of the delegate to closeWebSocketConnection, and switched dealloc to call closeWebSocketConnection.