Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Paho » Android MQTT Service - QoS 1 & Clean Session false strange behavior & reconnect behavior
Android MQTT Service - QoS 1 & Clean Session false strange behavior & reconnect behavior [message #1707103] Wed, 02 September 2015 10:59 Go to next message
Alexander Pampala is currently offline Alexander PampalaFriend
Messages: 3
Registered: September 2015
Junior Member
Hello. I have a running paho android mqtt service.. everything works great except one thing.

1) service is running & mobile network is enabled ... subscribed on topic with qos 1
2) server publish message "blabla1"
3) client get message "blabla1"
4) server publish message "blabla2"
5) client get message "blabla2"
6) client disabled mobile network
7) server publish message "offline blabla"
Cool client enabled mobile network
9) client get message "blabla1" and "offline blabla"

client after restarting mobile network always get first message

can someone help?

i tried 1.0.2 version and last snapshot too.. without success

// EDIT
I looks like first message never send PUBACK to server

// EDIT 2
Another strange behavior. Service reconnects only when network state changed. I restarted mqtt server and service doesn't reconnect.. only after i disabled and enabled mobile network.

[Updated on: Wed, 02 September 2015 13:18]

Report message to a moderator

Re: Android MQTT Service - QoS 1 & Clean Session false strange behavior & reconnect behavior [message #1707131 is a reply to message #1707103] Wed, 02 September 2015 13:29 Go to previous messageGo to next message
James Sutton is currently offline James SuttonFriend
Messages: 69
Registered: July 2015
Member
Hi,
Could you have sent the first message with retain on? And is this repeatable?

In regards to your second question: Network state change refers to the network state on the device itself (Mobile network, wi-fi etc..), not the network state of the server. If you restart the server the connection will drop and you will have to reconnect. You could of course add this behaviour to your application by repeatedly trying to reconnect after a disconnect or connection Lost, or maybe pinging the server until it is back online before attempting a re-connect.
Re: Android MQTT Service - QoS 1 & Clean Session false strange behavior & reconnect behavior [message #1707134 is a reply to message #1707131] Wed, 02 September 2015 13:47 Go to previous messageGo to next message
Alexander Pampala is currently offline Alexander PampalaFriend
Messages: 3
Registered: September 2015
Junior Member
I sent first message with retain : false... i tried same server configuration with javascript on web browser and it works. Could you give me example how to implement this reconnect mechanism which depend on lost connection and not on network state? I tried something like

MqttCallback -> connectionLost -> repeat mqtt.connect()

but it looks for me like inappropriate solution.. it should be implemented somewhere in mqtt service core like network state reconnect mechanism is implemented in core.. not in MqttAndroidClient interface

Thanks for replies

[Updated on: Wed, 02 September 2015 13:53]

Report message to a moderator

Re: Android MQTT Service - QoS 1 & Clean Session false strange behavior & reconnect behavior [message #1707377 is a reply to message #1707134] Fri, 04 September 2015 11:25 Go to previous messageGo to next message
Alexander Pampala is currently offline Alexander PampalaFriend
Messages: 3
Registered: September 2015
Junior Member
Problem with QoS behavior solved. I tried another mqtt broker and it works fine. Problem is with nodejs mosca mqtt broker.

Re: Android MQTT Service - QoS 1 & Clean Session false strange behavior & reconnect behavior [message #1707542 is a reply to message #1707377] Mon, 07 September 2015 08:23 Go to previous message
James Sutton is currently offline James SuttonFriend
Messages: 69
Registered: July 2015
Member
Thanks for letting us know! I'm glad you were able to get it working, I was quite stumped there!
Previous Topic:MQTT Paho Service Java Sample wont compile in Eclipse Helios
Next Topic:Paho Java Eclipse Utility
Goto Forum:
  


Current Time: Mon Sep 24 03:26:15 GMT 2018

Powered by FUDForum. Page generated in 0.02955 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top