GardenMobile & interfaces

Investigating Android Socket.IO polling timeouts

Separate transport timeouts, reverse-proxy upgrades, and certificate validation when diagnosing an old client.

The original Android Socket.IO 1.0.0 note began with this transport error:

io.socket.engineio.client.EngineIOException: xhr poll error
cause: java.net.SocketTimeoutException: timeout

A polling timeout describes where the request failed; it does not, by itself, identify a certificate, proxy, or application problem.

Separate the boundaries

Check the requested endpoint, client/server protocol compatibility, proxy route, and the point at which the connection times out. A WebSocket upgrade and a long-polling request also exercise different transport behavior.

The earlier workaround combined longer timeouts with a trust-all certificate manager and a hostname verifier that always returned true. That bypass removes the server-identity check, so its implementation is deliberately omitted here rather than republished as a solution. A timeout is not a reason to accept an arbitrary certificate or hostname.

Inspect the reverse proxy

The source also recorded this Nginx configuration:

upstream nodes {
  # enable sticky session based on IP
  ip_hash;
  # Backend nodejs server
  server 127.0.0.1:5500;
}


server {
  listen 80;
  # The host name to respond to
  server_name mysite.com;


  location / {
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header Host $host;


    proxy_pass http://nodes;


    # enable WebSockets
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
  }
} 

It preserves forwarding headers and passes the WebSocket upgrade. The hostname and upstream port are example configuration, and ip_hash is a routing choice rather than proof that every Socket.IO deployment needs the same setup.

This is a historical diagnosis note. No client was rebuilt or live connection tested for this revision.

← Back to the garden