"AMQJS0007E Socket error:undefined" on wifi connection loss while trying to subscribe for topics
See original GitHub issueDescribe the bug
I am trying to simulate a sudden connection loss, in between query and subscribe.
Even though adding a try/catch
block for subscribe()
, still there’s an unhandled promise rejection.
To Reproduce Using an iOS simulator, after all query operations are successful, disconnect simulator from WiFi connection.
Expected behavior
Since there was a network loss after query AND before or during the subscription process, observable’s error
callback should be able to handle this socket connection error.
Screenshots
Desktop (please complete the following information):
- OS: iOS
- Browser Safari
- Version 12.0.2
Smartphone (please complete the following information):
- Device: iPhone 8 simulator
- OS: iOS 12
Additional context I am using React Native. Using iPhone 8 simulator with debug mode enabled.
You can turn on the debug mode to provide more info for us by setting window.LOG_LEVEL = ‘DEBUG’; in your app.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:2
- Comments:8 (1 by maintainers)
Top GitHub Comments
Any update on this? I always get this error when trying to subscribe to a topic after internet is restored.
@pranavgawri, so what I did as a workaround was let the React Native component listen for network connectivity change. If the network changed from offline to wifi, I subscribe again. Previous subscription channels with disconnected socket under the hood were closed.