I am using com.koushikdutta.async:androidasync:2.1.3 as Android SocketIO client library. Is there a way to change the default heartbeat interval in the library?
Asked
Active
Viewed 371 times
1 Answers
1
The heartbeat is defined here
connecting = httpClient.executeString(request, null)
.then(new TransformFuture<SocketIOTransport, String>() {
@Override
protected void transform(String result) throws Exception {
String[] parts = result.split(":");
final String sessionId = parts[0];
if (!"".equals(parts[1]))
heartbeat = Integer.parseInt(parts[1]) / 2 * 1000;
else
heartbeat = 0;
It does have a fallback value of 0, but it gets its real value from
Integer.parseInt(parts[1]) / 2 * 1000;
The heartbeat used by AndroidAsync is derived from the value sent from the server:
heartbeat = Integer.parseInt(parts[1]) / 2 * 1000;
You cannot change the heartbeat value manually.
-
how should I change the heartbeat value set by server? – windchime Oct 31 '15 at 02:52
-
@windchime that depends on the server platform and language, cannot help you with that – Tim Oct 31 '15 at 12:13