Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [paho-dev] Disconnect when receiving messages

I had the same problem before! 
The problem for me was that you can not run network operations in the  Main thread (UI thread). You must make sure that Paho operation are performed in different thread or you will be disconnected when network traffic occurs.

// Petteri

30 nov 2012 kl. 11:04 skrev Dave Locke <locke@xxxxxxxxxx>:

the current version of the Paho Java should work on Android with the caveats re location of where messages are stored.  I have not come across the problem you mention where the client is disconnected when a message arrives.  Does the error occur before message arrived is called, during or after control is returned from it?  

There are some updates in progress to both fix a number of problems and add some enhancements to make it more friendly to Android. The update will also have been through a rigorous test on Android. Hoping to have this available in Dec.  


All the best
Dave

 



From:        Sergio Torassa <sergio.torassa@xxxxxxxxxxx>
To:        "paho-dev@xxxxxxxxxxx" <paho-dev@xxxxxxxxxxx>,
Date:        30/11/2012 09:30
Subject:        [paho-dev] Disconnect when receiving messages
Sent by:        paho-dev-bounces@xxxxxxxxxxx




Hello everybody,

I'm trying to use the mqtt paho library in an Android application for usage with a mosquitto server.
I eventually was able to solve all the issues wrt write permissions on Android directories, uses-permissions in the manifest and so on, but now each time the device receives a message, the client is disconnected with a message on the mosquitto server like this

Socket read error on client 0001, disconnecting.

Then the client has to reconnect and possibly to re-subscribe to all its topics.
My workaround is to re-connect and re-subscribe in the MqttCallback.ConnectionLost, but it is of course only a workaround.

Has anybody found a similar issue in implementing paho library?
If needed I can provide my code, but it is a very basic implementation of the paho client.

I add that the same issue is not present when I connect via other clients (e.g., mosquitto).
_______________________________________________
paho-dev mailing list
paho-dev@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/paho-dev


Unless stated otherwise above:
IBM United Kingdom Limited - Registered in England and Wales with number 741598.
Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU
_______________________________________________
paho-dev mailing list
paho-dev@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/paho-dev


Back to the top