mqtt-react-hooks
mqtt-react-hooks copied to clipboard
Seeking for help with lost of connection: Connection Closed: 1005
I have a react application with multiple components which are shown in a tab like structure like a browser with multiple tabs. Using mui buttons I'm able to display the corresponding tab however the MQTT connection closed with the 1005 errorcode. After trying lots of things I run out ideas so solve this.
Does someone have an idea what could be the problem?
- When I place a alert in the onclick() in stead of the switch tab function the connection remained open and I can send messages using a switch button on the already displayed tab
Does nobody have this problem?
@VictorHAS do you have an idea what could cause this problem? :)
@Aposhian @andyFang94 @alexgorbatchev @turingmachine do you have an idea what could cause this problem? :)
My best guess is that your Connector
component is getting rerendered for some reason. I would check the React dev tools and profile it to see what is getting rerendered when you switch tabs, and make sure that the Connector isn't getting rerendered.
@Aposhian @andyFang94 @alexgorbatchev @turingmachine do you have an idea what could cause this problem? :)
Hello, I made this code now here to try to explain. You will need the connector around the entire application and useSubscription to get connected