Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Access to sessionPresent after automatic reconnect #43

Open
fabianzwodrei opened this issue Feb 8, 2021 · 5 comments
Open

Access to sessionPresent after automatic reconnect #43

fabianzwodrei opened this issue Feb 8, 2021 · 5 comments
Labels

Comments

@fabianzwodrei
Copy link

Thanks for this fork and the maintenance.

I am testing a persistent connection between app and broker:
I am using the sessionPresent flag after a successul connection to decide if a new subscription is necessary: If server acknowlegdes the connection and set the sessionPresent=true, the app wont need new subscriptions.

But I can't access the sessionPresent flag after a automatic reconnect, because the onSuccess-callback of my IMqttActionListeneris not called. Only the IMqttActionListener onSuccess-callback contains the token for that flag

Am I wrong with my concept of connection and subscription - or might it be useful to implement some sort of access to that sessionPresent flag during the reconnection?

@hannesa2
Copy link
Owner

hannesa2 commented Feb 8, 2021

Hmm, is there a call onSuccess() missing ?
Anyway, if you found a solution, I'm happy to approve the solution !

@fabianzwodrei
Copy link
Author

The onSuccess Method of org.eclipse.paho.client.mqttv3 is called in case of a successful reconnect but there is only a
MqttReconnectActionListener as a callback called but not the onSuccess of my IMqttActionListener

I debugged this loc: https://github.com/eclipse/paho.mqtt.java/blob/6f35dcb785597a6fd49091efe2dba47513939420/org.eclipse.paho.client.mqttv3/src/main/java/org/eclipse/paho/client/mqttv3/internal/ConnectActionListener.java#L87

My workaround at the moment is to disable automatic Reconnect. And to reestablish the connection after 3secs

@fabianzwodrei
Copy link
Author

Note: The first connection made through MqttAndroidClient.connect(...) where I can set the callback to my callback, works perfectly. OnSuccess is called and I can access the sessionPresent comming from the broker server

@stale
Copy link

stale bot commented Apr 16, 2022

This issue has been automatically marked as stale because it has not had recent activity. Please comment here if it is still valid so that we can reprioritize. Thank you!

@stale stale bot added stale and removed stale labels Apr 16, 2022
@stale
Copy link

stale bot commented Jun 4, 2023

This issue has been automatically marked as stale because it has not had recent activity. Please comment here if it is still valid so that we can reprioritize. Thank you!

@stale stale bot added the stale label Jun 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants