I'm running the library in a Flutter application that is utilizing Bluetooth, and becomes backgrounded/paused often.
On iOS, I see the application be placed into the paused state for quite a while (~ an hour). Upon waking, I can see socket errors being emitted from the MQTT socket due to the paused state:
Main: Flutter Platform Dispatcher detected a flutter error: SocketException: Can't assign requested address (OS Error: Can't assign requested address, errno = 49), address = [AWS IoT URL HERE/), port = 49806, stack:
AND
SEVERE - Main: Flutter Platform Dispatcher detected a flutter error: SocketException: Bad file descriptor (OS Error: Bad file descriptor, errno = 9), address = [AWS IoT URL HERE), port = 53656, stack:
This is a perfectly expected error, as I'm sure the heartbeat/pings have expired. My question is - is there any way to catch and handle these exceptions, and prevent them being caught by the default Flutter Platform dispatcher handler, which I register in my main.dart file:
Which indicates these are unhandled. I have all of my MQTT calls wrapped in try... catch blocks, which is why I'm guessing this is being thrown outside of my main 'thread' of execution, possibly by some isolate? The stack is always empty here, which I can't really explain.
I'm guessing these are being run in some isolate beneath the MQTT5 package. Just curious if there's any way that we can handle these exceptions.... maybe expose the isolate so that I can do an addErrorListener() to it, or some other way to keep very normal and expected error from bubbling up to the top level unhandled exception handler.
I'm running the library in a Flutter application that is utilizing Bluetooth, and becomes backgrounded/paused often.
On iOS, I see the application be placed into the paused state for quite a while (~ an hour). Upon waking, I can see socket errors being emitted from the MQTT socket due to the paused state:
This is a perfectly expected error, as I'm sure the heartbeat/pings have expired. My question is - is there any way to catch and handle these exceptions, and prevent them being caught by the default Flutter Platform dispatcher handler, which I register in my main.dart file:
Which indicates these are unhandled. I have all of my MQTT calls wrapped in try... catch blocks, which is why I'm guessing this is being thrown outside of my main 'thread' of execution, possibly by some isolate? The stack is always empty here, which I can't really explain.
I'm guessing these are being run in some isolate beneath the MQTT5 package. Just curious if there's any way that we can handle these exceptions.... maybe expose the isolate so that I can do an addErrorListener() to it, or some other way to keep very normal and expected error from bubbling up to the top level unhandled exception handler.
Thank you in advance!