diff --git a/ably/realtime_conn.go b/ably/realtime_conn.go index ea85473f..65da541b 100644 --- a/ably/realtime_conn.go +++ b/ably/realtime_conn.go @@ -793,6 +793,9 @@ func (c *Connection) eventloop() { case actionConnected: c.mtx.Lock() + // recover is used when set via clientOptions#recover initially, resume will be used for all subsequent requests. + isConnectionResumeOrRecoverAttempt := !empty(c.key) || !empty(c.opts.Recover) + // we need to get this before we set c.key so as to be sure if we were // resuming or recovering the connection. mode := c.getMode() @@ -823,9 +826,6 @@ func (c *Connection) eventloop() { c.id = msg.ConnectionID isNewID := previousID != msg.ConnectionID - // recover is used when set via clientOptions#recover initially, resume will be used for all subsequent requests. - isConnectionResumeOrRecoverAttempt := !empty(c.key) || !empty(c.opts.Recover) - failedResumeOrRecover := isNewID && msg.Error != nil // RTN15c7, RTN16d if reconnecting && mode == recoveryMode && msg.Error == nil {