eclipse-paho / eclipse-paho/paho.mqtt.java

User defined ping interface

Open
#102 1 comment 0 reactions 0 assignees View on GitHub
enhancement help wanted
Dominant language
Java
Stars
2.3k
Forks
919
PR merge metrics
No merged PRs in 30d

Description

migrated from Bugzilla [#441960](https://bugs.eclipse.org/bugs/show_bug.cgi?id=441960)
status ASSIGNED severity _enhancement_ in component _MQTT-Java_ for _1.2_
Reported in version _1.0_ on platform _PC_
Assigned to: Bin Zhang

On 2014-08-18 07:48:53 -0400, Ian Craggs wrote:

> The current user-defined ping interface is MqttPingSender. The questions are:
>
> 1) is this really needed, and
>
> 2) if so, is this the best way of allowing a user-defined ping?
>
> I suggest merely allowing the application to call a ping method. The MQTT standard ping processing would carry on as normal, related to the keepalive interval which is set on the connect options.

On 2014-08-18 07:50:58 -0400, Ian Craggs wrote:

> Adding Prashant on copy.

On 2014-08-18 07:59:11 -0400, Ian Craggs wrote:

> I think I am convinced of the need of an application-defined ping request when:
>
> 1) the keepalive interval is large due to the wish to keep the TCP/IP traffic low (e.g. battery life, cost of network traffic)
> 2) some event occurs which the application knows about, but the MQTT library doesn't (like network connectivity change)
>
> an explicit ping call would allow this, assuming that connectionLost was called within a "reasonable" amount of time, not in this case the long keepalive interval.

On 2014-08-20 05:27:40 -0400, Bin Zhang wrote:

> I'm still not convinced regarding the necessity of the force ping.
> 1. Ping is only needed if there are no activities between client and server.
> 2. If the network changes, i.e. switch from wifi to 3G, the connection is lost.
> Ping is useless then and reconnect is needed.

On 2014-08-20 05:49:18 -0400, Ian Craggs wrote:

> (In reply to Bin Zhang from comment # 3)
>
> > I'm still not convinced regarding the necessity of the force ping.
> > 1. Ping is only needed if there are no activities between client and server.
> > 2. If the network changes, i.e. switch from wifi to 3G, the connection is
> > lost.
> > Ping is useless then and reconnect is needed.
>
> I'm assuming that causing a ping to be sent, and the response not to be received, will cause the connection lost logic to be invoked. Then a reconnect will be made by the application.

On 2014-08-20 10:30:37 -0400, Bin Zhang wrote:

> Ok, i will implement a new ping interface, and deprecated the old MqttPingSender

On 2014-08-22 05:07:42 -0400, Shankar karuppiah wrote:

> Another reason to have application-defined ping request is that currently ping request will not be sent when Android app goes into deep sleep state when the user puts the device into deep sleep state (aka user locks the screen).
>
> Current work around for this is that to setup an Alarm using Android Alarm Manager and wake up the app and publish an 1 byte message with qos 0, and hope that it will trigger the ping request.
>
> I think having application-defined ping request solve this problem.

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.