[ 
https://issues.apache.org/jira/browse/AMQ-6639?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15947153#comment-15947153
 ] 

Aland Valdor commented on AMQ-6639:
-----------------------------------

Hello,
We cannot give a TU because we noticed the issue with a mobile phone that lose 
the network. it is hard for us to simulate that event.
But I can give you the steps to reproduce it with some piece of code.
Step 1) use a tool P(ex mosquitto_sub) listening the topic X.
Step 2)  connect your mobile to the MQTT server. Mobile send a retain message 
to the topic X
Step 3) MQTT server push the retain message to the tool P.
Step 4)  Activate "AirPlane" mode on the mobile
Step 5) 10 seconds after, unactivate "AirPlane" mode. A retain message must be  
send again to topic X.
Step 6) MQTT server push the retain message to the tool P.
Step 7) wait for 2 minutes. MQTT push a LWT to tool P

This is an example the code used on our mobile application to send message to 
MQTT server
{code:javascript}
var i_am_connected = new Paho.MQTT.Message(JSON.stringify({
        version: 1,
        state: 2,
        timestamp: startListeningTimeInS,
        deverylight: Version,
        os: ionic.Platform.platform(),
        release: ionic.Platform.version()
      }));
      i_am_connected.destinationName = "device/" + LoginService.userData.token 
+ "/ping";
      i_am_connected.retained = true;
      i_am_connected.qos = 1;


var i_am_connected = new Paho.MQTT.Message(JSON.stringify({
        version: 1,
        state: 2,
        timestamp: startListeningTimeInS,
        deverylight: Version,
        os: ionic.Platform.platform(),
        release: ionic.Platform.version()
      }));
      i_am_connected.destinationName = "device/" + LoginService.userData.token 
+ "/ping";
      i_am_connected.retained = true;
      i_am_connected.qos = 1;

client.connect({
        timeout: 3,
        useSSL: false,
        cleanSession: true,
        userName: LoginService.userData.token,
        password: '',
        willMessage: i_am_disconnected,
        onSuccess: function() {
          timeOfConnectionLoss = 0;
          service.connected = 2;
          client.send(i_am_connected);
          //resubscribing
          Object.keys(subscriptions).forEach(function (topic) {
            client.subscribe(topic);
          });

          window.addEventListener('unload', disconnect);
          deferred.resolve();
        },
        onFailure: onConnectionLost
      });
{code}

> MQTT : "Lost Connection" LWT message are not cancelled after network come back
> ------------------------------------------------------------------------------
>
>                 Key: AMQ-6639
>                 URL: https://issues.apache.org/jira/browse/AMQ-6639
>             Project: ActiveMQ
>          Issue Type: Bug
>          Components: MQTT
>    Affects Versions: 5.13.3
>         Environment: linux.
> Application android and ios
>            Reporter: Aland Valdor
>
> Hello,
> We have an issue with the MQTT ActiveMQ.
> This is our situation:
> Our mobile applications are connected to our ActiveMQ MQTT server.
> We use the LWT message to detect the mobile "network lost".
> We noticed that when we got a mobile "network lost", the LWT message is sent 
> 90s after the disconnect.  If the network comes back before 90s, a retained 
> message is sent to alert the server. But we saw that the "network lost" LWT 
> message is STILL sent even if we received the retained message.
> For me, the LWT message "network lost" should be cancelled if we received a 
> new retained message. 



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to