About the closed() event, and reconnection strategy

sulliwanesulliwane Member MaxOrganization: persoProject: chat middleware
edited September 2016 in Help Center

Hello,

When directly connecting to an ICE server (no GLACIER2) from my node.js app (V3.6.2), I set ACM like this:

id.properties.setProperty('Ice.ACM.Close', '4');
id.properties.setProperty('Ice.ACM.Heartbeat', '3');
id.properties.setProperty('Ice.ACM.Timeout', '15');

proxy.ice_getCachedConnection().setCallback({
        closed() {
          debug('who called this closed() function???');
        },
});

It seems to me as the closed() function is actually called remotely by the ICE server.

If I disconnect the networking on my client, the closed() function is called only once I reconnect the networking again (which means that my client can connect to the server, detect that it has been closed by the server, and then invoke the closed() function.

I am correct?

if yes, my next question will be: should I try to detect a network failure, or should I just wait that my closed() function has been invoked to call again my reconnect() logic.

Many thanks for your answers !! :)

Tagged:

Answers

  • benoitbenoit Rennes, FranceAdministrators, ZeroC Staff Benoit FoucherOrganization: ZeroC, Inc.Project: Ice ZeroC Staff

    As previously mentioned on this thread, when the closed callback is called depends on the operating system and browser (when using a JavaScript client). In theory, it is called as soon as the connection closure is detected. I don't know why it takes so long for the browser to detect it. Could you indicate which operating system and browser version you're using?

    Cheers,
    Benoit.

Sign In or Register to comment.