Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [paho-dev] Fwd: HELP: Android Client Not Recieving Messages sometimes even though default PING are Success

Dishant,

thanks for the information.  Maybe there's some way we can protect against that.

Ian

On 28/02/15 06:31, dishant ghai wrote:
Hi All,

Thanks for your Help. After much debugging I found out that when the client stopped getting messages the frequency of pings have actually reduced and it was always happening after a Reconnect (not every time after reconnect but definitely after a reconnect).

This led me to inspect my connect call. I realised that I was using an overloaded connect function in wrong manner :

My Usage : 
c.getClient().connect(c.getConnectionOptions(),callback);

Correct Usage:
c.getClient().connect(c.getConnectionOptions(),null,callback);

Because of this it was somehow treating my c.getConnectionOptions()  as UserContext (according to the 2 parameter overloaded method signature) 
and maybe then taking default values for connectOptions setting the clean session flag to TRUE and what not. Because of this it did not give any errors.

So it was a null that made all the difference.

I hope my solution is of help to someone who just needs nothing(null) more than he already has.

-Dishant

On Thu, Feb 26, 2015 at 11:37 PM, Manuel Domínguez Dorado <manolodd@xxxxxxxxx> wrote:
Opps!! It's true. It is already subscribed to topics after reconnects. Great!! That's new for me.

Sorry Dishant, I was wrong.

2015-02-26 15:31 GMT+01:00 Ian Craggs <icraggs@xxxxxxxxxxxxxxxxxxxxxxx>:
Hi Dishant,

your understanding of the cleansession behaviour is correct.

Does anything cause the Android service to start receiving messages again?

Ian



On 02/26/2015 08:26 AM, dishant ghai wrote:
Thanks Manuel for your quick reply. Highly appreciated.

I read in the docs that  if we use persistent client (clean session flag = false) then the broker remembers the subscriptions across connections and sends the undelivered messages from the last connection in the next connection to the subscribers. is this not right ?

 I am actually subscribing to the topic only once and storing the topic in a SqlLite Database in Android 
On any attempt to join a topic I am  not subscribing again  if the topic is found in the database.
I am successfully getting the undelivered messages on reconnect without subscribing again.

Everything goes on well suddenly sometimes the client does not recieve  the published messages.

your suggestions would be helpful.

-Dishant



On Thu, Feb 26, 2015 at 1:42 PM, Manuel Domínguez Dorado <manolodd@xxxxxxxxx> wrote:

Hi,

Have you coded any logic to re-subscribe after re-connect? It seems that you re-connect but you do not re-subscribe to desired topics and therefore don't receive messages.

Pehaps this is the problem.

Regards.

El 26/02/2015 08:59, "dishant ghai" <dishant.ghai@xxxxxxxxx> escribió:

Hi,

I am using mqtt paho 3-1.0.1 for my Android App and a mosquito broker.

I am able to Successfully Connect/Publish / Subscribe from my AndroidClient with Qos 1 and cleanSession=false

I have also implemented for Network Change Events and reconnect with broker , I get undelivered messages on reconnect. This works fine most of the times.

However, sometimes the client stops receiving messages which are being published to the broker by other clients and even the same client .Strangely, the default AlarmPingSender  keeps getting Success on Keepalive interval. No subsequent messages are received.  

Also the client is able to use the same connection to PUBLISH at this time and the publishes are received by the broker overtime but no messages are received by MqttCallBackHandler not even the immediately published message by the same client.

Kindly help, as I am stuck in my App Development.

Regards

Dishant Ghai 


_______________________________________________
paho-dev mailing list
paho-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/paho-dev

_______________________________________________
paho-dev mailing list
paho-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/paho-dev



_______________________________________________
paho-dev mailing list
paho-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/paho-dev

-- 
Ian Craggs                          
icraggs@xxxxxxxxxx                 IBM United Kingdom
Paho Project Lead; Committer on Mosquitto


_______________________________________________
paho-dev mailing list
paho-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/paho-dev



--
---
Manuel Domínguez Dorado
ingeniero ARROBA ManoloDominguez PUNTO com
http://www.ManoloDominguez.com

_______________________________________________
paho-dev mailing list
paho-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/paho-dev



Back to the top