The ConnectionManager decides, when a transport drops (or fails to connect), whether to fall back to the disconnected state or to suspended. The idea is that suspended happens if it has been more than 2 minutes (Defaults.SUSPEND_TIME) since the last time it was connected.
The way this was implemented was to keep a record of the time at which suspended will be triggered, via setSuspendTime() : https://github.com/ably/ably-java/blob/master/lib/src/main/java/io/ably/lib/transport/ConnectionManager.java#L552
The problem is that this is only called when a connection is first established, not when it transitions from connected to disconnected: https://github.com/ably/ably-java/blob/master/lib/src/main/java/io/ably/lib/transport/ConnectionManager.java#L398.
The result is that if a connection has been up for at least 2 minutes, it then goes straight to suspended when the connection drops :(
The
ConnectionManagerdecides, when a transport drops (or fails to connect), whether to fall back to thedisconnectedstate or tosuspended. The idea is thatsuspendedhappens if it has been more than 2 minutes (Defaults.SUSPEND_TIME) since the last time it was connected.The way this was implemented was to keep a record of the time at which
suspendedwill be triggered, viasetSuspendTime(): https://github.com/ably/ably-java/blob/master/lib/src/main/java/io/ably/lib/transport/ConnectionManager.java#L552The problem is that this is only called when a connection is first established, not when it transitions from
connectedtodisconnected: https://github.com/ably/ably-java/blob/master/lib/src/main/java/io/ably/lib/transport/ConnectionManager.java#L398.The result is that if a connection has been up for at least 2 minutes, it then goes straight to
suspendedwhen the connection drops :(