I have a mqtt broker which does not support websocket connection. I need to write an HTML webpage that will connect to the broker and publish a message string on it. Is it possible to not use websockets through my web page and still connect and publish data? If so, how can I do that?
Asked
Active
Viewed 510 times
1 Answers
1
No, you can not connect to anything from with in a browser with anything other than HTTP or WebSockets.
A possible solution is to set up a separate WebSockets to MQTT bridge between the web page and the broker.

hardillb
- 54,545
- 11
- 67
- 105
-
https://www.quora.com/What-do-Javascript-MQTT-clients-need-to-go-through-a-websocket-and-cannot-directly-establish-a-MQTT-connection-to-the-MQTT-broker – SMG Oct 14 '16 at 19:03
-
https://www.quora.com/What-do-Javascript-MQTT-clients-need-to-go-through-a-websocket-and-cannot-directly-establish-a-MQTT-connection-to-the-MQTT-broker- I read in one of the comments that says browserfy? Any help on that?> – SMG Oct 14 '16 at 19:04
-
No, that won't change anything – hardillb Oct 14 '16 at 19:05
-
So all the possible ways of using mqtt protocol uses web sockets and nothing else? Can I use any of these http://www.hivemq.com/blog/mqtt-client-library-encyclopedia/ – SMG Oct 14 '16 at 19:12
-
http://stackoverflow.com/questions/30624897/direct-mqtt-vs-mqtt-over-websocket/30625067#30625067 - I read your comment here. Is this something relevent? – SMG Oct 14 '16 at 19:19
-
WebSockets are a way of connecting to a two way communication pipe, just like a normal TCP socket, but from within a web browser. If you want to use MQTT from within a browser, you need to use a WebSocket. If you are not within a web browser, you don't need WebSockets. – njh Oct 15 '16 at 00:24
-
I am using this source to connect and publish to a mqtt borker - http://www.hivemq.com/blog/mqtt-client-library-encyclopedia-mosquitto-php – SMG Oct 17 '16 at 15:01
-
I am using mqtt.fx to subscribe to the topic I published my earlier data. But I cannot see and messages that are published on my topic. Any help on this? – SMG Oct 17 '16 at 15:02