Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [paho-dev] Paho API in Android Messaging

Darren,

 

mosquito_sub will accept # as the subscription topic but on a Linux/Unix system, you just have to escape it with a leading \ first.  I experienced this the first time I moved over to Debian coming from Windows.

 

Tucker,

 

I’ve never used the Async client before but from what I have done with the standard client, it appears that you are doing things in the correct order.  Could you also show the code where you are publishing the data?  That might also help others determine if something is not right.  Also, have you setup users and access control lists on the mosquitto broker?  Maybe it is something that may not be correct there.  If you could share some of that too, it might help.

 

Thanks,

Dwayne

 

 

From: paho-dev-bounces@xxxxxxxxxxx [mailto:paho-dev-bounces@xxxxxxxxxxx] On Behalf Of Darren Clark
Sent: Tuesday, November 26, 2013 2:56 PM
To: General development discussions for paho project
Subject: Re: [paho-dev] Paho API in Android Messaging

 

Tucker,

It may be that the client and/or broker isn't happy with the # wildcard as the subscription topic.  For example the mosquitto_sub client app doesn't accept that(didn't test to see if the broker does). Maybe try something like +/# or +/# AND + if you really want "everything"

-Darren

 

On Tue, Nov 26, 2013 at 2:43 AM, Rhys Short <rhys.short@xxxxxxxxxxx> wrote:

Hi Tucker,

 

What is the logcat output when you run your application? It might have some clues to why your app is not working as expected.

Regards

 

Rhys 


On 26 Nov 2013, at 03:07, "Tucker Vento" <tuckervento@xxxxxxxxx> wrote:

hi paho people

 

I'm working on a (hopefully) lightweight two person messaging app using the MQTT protocol, and currently I'm trying to use the paho library to accomplish this.  I have a mosquitto broker running on a debian box, and as far as I can tell it's running without issue.  however, I am unable to receive messages on my app; publishing them works fine, and I can watch with a command line client from the server and see the message arrive, but neither Android client will receive a message from the other.  I'm implementing MqttCallback on my service...this is also my first app, so it's possible I'm misunderstanding some part of the Android lifecycle, but I think the service should be open to receive connections from the broker?  Here's where I set up the client on the service:

 

public void setUpService(final Context p_context){

    setUpDatabases(p_context);

    try {

        _mqttClient = new MqttAsyncClient(_mqttServer, _clientId, new MqttDefaultFilePersistence(p_context.getFilesDir().getAbsolutePath()));

 

        _mqttClient.setCallback(this);

        _mqttOptions.setCleanSession(false);

        _mqttOptions.setKeepAliveInterval(_keepAlive);

        _mqttOptions.setConnectionTimeout(_connectionTimeout);

        IMqttToken token = _mqttClient.connect(_mqttOptions);

        token.waitForCompletion();

        IMqttToken token2 = _mqttClient.subscribe("#", 2);

        token2.waitForCompletion();

    } catch (MqttException e) {

        handleMqttException(e);

    }

    SETUP_STATE = true;

}

 

that's all the code directly related to setting up the connection...in debugging, I found that my messageArrived override is never even being called.  that seems like an awful small amount of code to set up such an integral part of my app...so I'm thinking it's too good to be true (hence it not working).  am I missing some part of the set-up process?  could my service be blocked somewhere else and therefore never receiving these messages?  it seems unlikely that they would NEVER come through...considering the app isn't locked up or anything.

I'm at an impasse, so any guidance would be very appreciated!

 

thanks,

tucker

 

 

--

_______________________________________________
paho-dev mailing list
paho-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/paho-dev


_______________________________________________
paho-dev mailing list
paho-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/paho-dev

 


Back to the top