diff options
Diffstat (limited to 'AndroidAsync/src/com/koushikdutta/async/http/socketio/SocketIORequest.java')
-rw-r--r-- | AndroidAsync/src/com/koushikdutta/async/http/socketio/SocketIORequest.java | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/AndroidAsync/src/com/koushikdutta/async/http/socketio/SocketIORequest.java b/AndroidAsync/src/com/koushikdutta/async/http/socketio/SocketIORequest.java index 49ff2da..f98407f 100644 --- a/AndroidAsync/src/com/koushikdutta/async/http/socketio/SocketIORequest.java +++ b/AndroidAsync/src/com/koushikdutta/async/http/socketio/SocketIORequest.java @@ -1,7 +1,6 @@ package com.koushikdutta.async.http.socketio; import android.net.Uri; -import android.text.TextUtils; import com.koushikdutta.async.http.AsyncHttpPost; @@ -10,6 +9,11 @@ public class SocketIORequest extends AsyncHttpPost { this(uri, ""); } + Config config; + public Config getConfig() { + return config; + } + String endpoint; public String getEndpoint() { return endpoint; @@ -25,8 +29,37 @@ public class SocketIORequest extends AsyncHttpPost { } public SocketIORequest(String uri, String endpoint, String query) { + this(uri, endpoint, query, null); + } + + public SocketIORequest(String uri, String endpoint, String query, Config config) { super(Uri.parse(uri + (query == null ? "" : "?" + query)).buildUpon().encodedPath("/socket.io/1/").build().toString()); + this.config = (config != null) ? config : new Config(); this.endpoint = endpoint; this.query = query; } + + public static class Config { + long reconnectDelay = 1000L; + public void setReconnectDelay(long reconnectDelay) { + if (reconnectDelay < 0L) { + throw new IllegalArgumentException("reconnectDelay must be >= 0"); + } + this.reconnectDelay = reconnectDelay; + } + public long getReconnectDelay() { + return reconnectDelay; + } + + long reconnectDelayMax = 0L; + public void setReconnectDelayMax(long reconnectDelayMax) { + if (reconnectDelay < 0L) { + throw new IllegalArgumentException("reconnectDelayMax must be >= 0"); + } + this.reconnectDelayMax = reconnectDelayMax; + } + public long getReconnectDelayMax() { + return reconnectDelayMax; + } + } } |