mqtt websocket ports [message #1836088] |
Sun, 20 December 2020 14:00 |
B G Messages: 1 Registered: December 2020 |
Junior Member |
|
|
Hi,
I have a nodejs script that I can run on a ( windows) cmd line. It uses port 1883 and can connect to my mosquitto mqtt broker ( 127.0.0.1), It publishs a request to the esp8266 for a status and subscribes to the responce topic, when it gets the responce it closes the connection - it works well, every time i run it. sorry if this is a stupid question - Can I call this .js file from a html and get the responce back into the html page ?
Secondly - .. I have since setup my mosquitto broker with a second listener on port 9001 for websockets, and it allows anoymonous connections.
My esp8266 still successfully connects to the broker through 1883. My .js script ( mentioned above) still works - using 1883.
I have a html page using the paho liberaries, that sucessfully connects to the broker ( using 9001), like the .js script above, I plan to publish to the esp8266 for a status , and then subscribe for a responce... I can see the esp8266 sees the published resquest and does send a responce .. but the html page does not receive it ... and at the same time the esp8266 disconnects from the broker and dosnt automatically reconnect ... I'm not sure why. The only way i can get it to connect back is to stop and restart the broker.
( i've tried a differnt listener port - 8080 - but get the same issue.)
am i missing something ? - should i post my code ?
|
|
|
Powered by
FUDForum. Page generated in 0.03198 seconds