eclipse-paho / eclipse-paho/paho.mqtt.javascript

Keepalive processing needs two timers

Open
#23 2 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
JavaScript
Stars
1.2k
Forks
466
PR merge metrics
No merged PRs in 30d

Description

migrated from Bugzilla [#442692](https://bugs.eclipse.org/bugs/show_bug.cgi?id=442692)
status NEW severity _normal_ in component _MQTT-JS_ for _1.1_
Reported in version _1.0_ on platform _PC_
Assigned to: Tang Zi Han

On 2014-08-27 07:13:16 -0400, Ian Craggs wrote:

> I realized yesterday that the keepalive processing in the C client was not correct. In discussion with Al we realized that two timers are needed, one for keeping track of the last packet sent, the other to keep track of the last packet received.
>
> This is because they are used for two different purposes. The last packet sent timer is used to stop the server closing the session. A ping must be sent within the keepalive interval if no other packet has been sent to the server, to notify it that the client application is still alive.
>
> The last packet received timer is used to determine that the TCP connection is still active. If you pull the network cable out of a machine, TCP writes will still work until the TCP buffer is full. Even then, you only get a buffer full notification (on Linux at least), not a network error. Only when the TCP keepalive timeout kicks in would the client be notified that the network had failed. So, if packet has not been received from the server within a reasonable amount of time (the keepalive time is a good value), then a ping should also be sent. If a response is not received from the server, then the TCP connection can be assumed to have failed, and the "connection lost" processing should be invoked.
>
> This needs to be checked for the Javascript client.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.