Search code examples
push-diffusion

Diffusion reconnect timeout


I am using Diffusion v5.6.6 to create a mobile app and it is important that the app recovers when clients lose mobile connection and then gain connection again later on. I can see in Connectors.xml there are two settings related to this:

<!-- This is the idle time (no inbound messages) before a
     client will be pinged by the server. A response must
     be received by Diffusion before the next interval,
     else the client is considered to be disconnected. -->
<system-ping-frequency>90s</system-ping-frequency>

and

<reconnect>
   <!-- This is the amount of milliseconds a session
        will be kept alive after a sudden connection loss. -->
   <keep-alive>60000</keep-alive>
</reconnect>

What is the difference between this 90 second ping and the 60 second keep alive?


Solution

  • From the relevant page of the Diffusion manual:

    With regards to the 60 second keep alive; when a client loses connection it goes into a reconnecting state where the session persists on the server until the client reconnects or the keep alive time is reached and the session is destroyed. Messages for the client are still queued while in the reconnecting state.

    With regards to the 90 second ping; system-ping-frequency specifies a frequency with which the server will ping the client. This is used to detect that a client has been disconnected and if a response is not received from the client before the expiry of another interval period the client is assumed to be disconnected. If the value is set to 0 clients are not pinged.