-
Notifications
You must be signed in to change notification settings - Fork 176
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
MQTT updates not working while changing Networks #448
Comments
OK I'll need a log from the autoreconnect point onwards. When you say you resubscribed do you have an onSubscribe callback to check if the subscription worked? |
Thanks, @shamblett for your quick response. Subscriptions are happening correctly, but I am not sure what should I do when the network changes by User. Let's say as an example, that User A has Mobile Data and Wifi both connected while using the app but when the user turns off the WIFI, I get a callback from the network listener about the network being disconnected and that same time, I am disconnecting the MQTT and when I am receiving callback of network about mobile data is connected, I am calling below connectMQTT function. This same function calls(main function) when a user opens an app from killed mode.
|
OK but I still need a log as I said above, I need to see whats happening at run time. |
Okay, I got an issue and this time you don't need logs.
I am using an app with Mobile and Wifi both in ON status and when I switch off the Wifi, the Network listener callback with No Internet and at that time I am doing I also got a connected event when I connect to MQTT again but I also got the event in the And so for a final solution, I set ONE IMPORTANT THING IS, |
Thanks for your response.
Shall I know how can I track the connection listener?
I would like to do some function when connection status becoming connecting
or disconnecting or onFaulted.
…On Sun, 5 Mar, 2023, 4:01 pm Steve Hamblett, ***@***.***> wrote:
Closed #448 <#448> as
completed.
—
Reply to this email directly, view it on GitHub
<#448 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACVDNJ5BI2I5BR7GAZK6RPLW2RTQHANCNFSM6AAAAAAVHGXZ5I>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
I'm not unerstanding you, why can't you use the onConnected and onDisconnected callbacks? Note the API comment from onDisconnected -
|
I would like to show message to user that MQTT is connecting when MQTT
trying to reconnect and I don't know how to do that.
…On Sun, 5 Mar, 2023, 4:46 pm Steve Hamblett, ***@***.***> wrote:
I'm not unerstanding you, why can't you use the onConnected and
onDisconnected callbacks? Note the API comment from onDisconnected -
/// Client disconnect callback, called on unsolicited disconnect.
/// This will not be called even if set if [autoReconnect} is set,instead
/// [AutoReconnectCallback] will be called.
—
Reply to this email directly, view it on GitHub
<#448 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACVDNJ34DNS5HQVIR4Q2HWLW2RYXXANCNFSM6AAAAAAVHGXZ5I>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Please have a look at the API -
If you hook these up(assuming you are using autoreconnect) then when onAutoReconnect is called then you can tell your user that they are disconnected until onAutoReconnected is called, similarly if you are not using autoreconnect for onDisconnected/onConnected. |
Thanks for your response.
Let suppose, My MQTT client connected and suddenly internet break down, at
that time I need to show users that internet is break down and MQTT will be
up when internet is up and running.
Can you please demonstrate which callback can tell me internet break down
and mqtt is not connected for while?
…On Sun, 5 Mar, 2023, 4:58 pm Steve Hamblett, ***@***.***> wrote:
Please have a look at the API -
/// Client disconnect callback, called on unsolicited disconnect.
/// This will not be called even if set if [autoReconnect} is set,instead
/// [AutoReconnectCallback] will be called.
DisconnectCallback? onDisconnected;
/// Client connect callback, called on successful connect
ConnectCallback? onConnected;
/// Auto reconnect callback, if auto reconnect is selected this callback will
/// be called before auto reconnect processing is invoked to allow the user to
/// perform any pre auto reconnect actions.
AutoReconnectCallback? onAutoReconnect;
/// Auto reconnected callback, if auto reconnect is selected this callback will
/// be called after auto reconnect processing is completed to allow the user to
/// perform any post auto reconnect actions.
AutoReconnectCompleteCallback? onAutoReconnected;
If you hook these up(assuming you are using autoreconnect) then when
onAutoReconnect is called then you can tell your user that they are
disconnected until onAutoReconnected is called, similarly if you are not
using autoreconnect for onDisconnected/onConnected.
—
Reply to this email directly, view it on GitHub
<#448 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACVDNJYQBKMSXEJ73LYBJRDW2R2GPANCNFSM6AAAAAAVHGXZ5I>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
I open the application with Wifi and Mobile both ON status and so MQTT connected successfully because it's initialized in the MAIN file, and I also got messages in MQTT.UPDATES.LISTEN callbacks.
My App is in foreground mode and now I am turning off the Wifi at that time, Auto Reconnected called and also resubscribed the topic but I am not getting any response in MQTT.UPDATES.LISTEN callbacks.
The text was updated successfully, but these errors were encountered: