Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add missing clientOptions #957

Merged
merged 4 commits into from
Jul 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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 @@ -216,6 +223,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