Timout Issue
Not getting timeout event some times in call() Emitter.Listener. but its coming in Manager open() method in timeout
if (Manager.this._timeout >= 0) {
final long timeout = Manager.this._timeout;
logger.fine(String.format("connection attempt will timeout after %d", timeout));
final Future timer = getTimeoutScheduler().schedule(new Runnable() {
@Override
public void run() {
EventThread.exec(new Runnable() {
@Override
public void run() {
logger.fine(String.format("connect attempt timed out after %d", timeout));
openSub.destroy();
socket.close();
socket.emit(Engine.EVENT_ERROR, new SocketIOException("timeout"));
self.emitAll(EVENT_CONNECT_TIMEOUT, timeout);
}
});
}
}, timeout, TimeUnit.MILLISECONDS);
Manager.this.subs.add(new On.Handle() {
@Override
public void destroy() {
timer.cancel(false);
}
});
}
Sorry I couldn't understand the problem. Can you explain the details of the issue?
Once I connect to my server using Socket socketio=IO.socket(ip:port) and trying to connect other server using same instance of socketio. sometimes its work and coming in above Manager open() method in timeout section. and sometimes its not.
And If I want to reconnect to server so which method I need to use. I can use same instance of Socket Right?
Am I correct that you mean to connect to different servers by calling IO.socket(ip:port) twice? That should work.
I'm not sure about the timeout, but you can just call socket.connect(); to reconnect.