0

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?

hata
  • 11,633
  • 6
  • 46
  • 69
windchime
  • 1,253
  • 16
  • 37

1 Answers1

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;

According to koush himself:

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.

Community
  • 1
  • 1
Tim
  • 41,901
  • 18
  • 127
  • 145