         _connecting = false
         _reconnecting = false
         currentReconnectAttempt = 0
-        reconnectTimer?.invalidate()
-        reconnectTimer = nil
+        clearReconnectTimer()
         
         // Don't handle as internal because something crazy could happen where
         // we disconnect before it's handled

        engine = SocketEngine(client: self, opts: opts)
    }
    
    /**
    Closes the socket. Only reopen the same socket if you know what you're doing.
    Will turn off automatic reconnects.

    // We lost connection and should attempt to reestablish
    @objc private func tryReconnect() {
        if reconnectAttempts != -1 && currentReconnectAttempt + 1 > reconnectAttempts || !reconnects {
            clearReconnectTimer()
            didDisconnect("Reconnect Failed")
            
            return
        } else if connected {
            _connecting = false
