Getting MQTT ( and other) data via websockify

not sure how many want to get mqtt or other data directly with out having to go through node-red, but it possible with websockify. but you can also use it to get serial data, start programs to grab data and MQTT from mosquitto ( since some arm OS’s mosquitto 1.4 that has websockets is not working- i gave up trying to compile a working version of mosquitto 1.4 with websockets after umpteen times of trying - could get the broker to compile properly but the clients would be broken every time-- hence why i went the websockify route ) – nothing wrong with node-red but it was a bit of repetitive that every time I added MQTT topic I had to add one to node-red and another on to freeboard now it more direct and simplified…

to do it you simply need to install websockify ( sudo apt-get install websockify )
start it with the arguments websockify 9001 localhost:1883 ( or what port you use)
now it will listen at port 9001 and pass it down to port 1883 to mosquitto
to use it for mqtt you simply use this version of mqttws31.js that i modified .
mqttws31.js.zip (18.7 KB)

will translate the data to binary mode instead of text mode

if using freeboard then “GitHub - wwolkers/freeboard-websocket-mqtt: Plugin for Freeboard to communicate using MQTT over websocket” seams to work the best other option is “GitHub - alsm/freeboard-mqtt: MQTT and IBM IoT Foundation plugins for freeboard.io” but I find it a bit glitchy… or construct a webpage in html or handlebars in your widget panel

good luck, have fun.

Update: after some heavy testing I am finding the websockify is much more stable then node-red. node-red was having latency issues. I had to slow down the publishing, otherwise alot of published topics were bring dropped. with websockify it does not seem to matter if i rapid fire a bunch of published topics, not one is dropped. red-node, under the same conditions, would drop 50+% of them.