Skip to content

Commit

Permalink
Merge pull request #957 from ably/fix/missing-clientOptions
Browse files Browse the repository at this point in the history
Add missing clientOptions
  • Loading branch information
AndyTWF committed Jul 6, 2023
2 parents 63e5b9a + 7ea2aef commit 010a1d7
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ void enact(StateIndication stateIndication, ConnectionStateChange change) {

class Suspended extends State {
Suspended() {
super(ConnectionState.suspended, false, false, false, Defaults.connectionStateTtl, REASON_SUSPENDED);
super(ConnectionState.suspended, false, false, false, ably.options.suspendedRetryTimeout, REASON_SUSPENDED);
}

@Override
Expand Down
7 changes: 6 additions & 1 deletion lib/src/main/java/io/ably/lib/transport/Defaults.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,19 @@ public class Defaults {
public static int TIMEOUT_HTTP_OPEN = 4000;
/* TO3l4 */
public static int TIMEOUT_HTTP_REQUEST = 15000;
/* TO3l6 */
public static int httpMaxRetryDuration = 15000;

/* DF1b */
public static long realtimeRequestTimeout = 10000L;
/* TO3l2 */
public static long suspendedRetryTimeout = 30000L;
/* TO3l10 */
public static long fallbackRetryTimeout = 10*60*1000L;
/* CD2h (but no default in the spec) */
public static long maxIdleInterval = 20000L;
/* DF1a */
public static long connectionStateTtl = 60000L;
public static long connectionStateTtl = 120000L;

public static final ITransport.Factory TRANSPORT = new WebSocketTransport.Factory();
public static final int HTTP_MAX_RETRY_COUNT = 3;
Expand Down
16 changes: 16 additions & 0 deletions lib/src/main/java/io/ably/lib/types/ClientOptions.java
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,13 @@ public ClientOptions(String key) throws AblyException {
*/
public int httpRequestTimeout = Defaults.TIMEOUT_HTTP_REQUEST;

/**
* Denotes elapsed time in which fallback host retries for HTTP requests will be attempted.
* Default is 15 seconds.
* Spec: TO3l6
*/
public int httpMaxRetryDuration = Defaults.httpMaxRetryDuration;

/**
* The maximum number of fallback hosts to use as a fallback when an HTTP request to the primary host
* is unreachable or indicates that it is unserviceable.
Expand Down Expand Up @@ -225,6 +232,15 @@ public ClientOptions(String key) throws AblyException {
*/
public String[] fallbackHosts;

/**
* This is a timeout when the connection enters the suspendedState.
* Client will try to connect indefinitely till state changes to connected.
* The default is 30 seconds.
* <p>
* Spec: RTN14d, TO3l2
*/
public long suspendedRetryTimeout = Defaults.suspendedRetryTimeout;

/**
* An array of fallback hosts to be used in the case of an error necessitating the use of an alternative host.
* If you have been provided a set of custom fallback hosts by Ably, please specify them here.
Expand Down

0 comments on commit 010a1d7

Please sign in to comment.