1.Install libwebsockets
$ wget http://git.libwebsockets.org/cgi ... 3-firefox-36.tar.gz
$ tar zxvf libwebsockets-1.4-chrome43-firefox-36.tar.gz
$ cd libwebsockets-1.4-chrome43-firefox-36
$ mkdir build
$ cd build
$ cmake ..
$ make install
$ ldconfig
2.Config mosquitto to support websocket
a.Edit configure.mk:
WITH_WEBSOCKETS:=yes
b.Edit /etc/mosquitto/mosquitto.conf:
port 1883
listener 9001
protocol websockets
3.You may get this error:
"mosquitto: error while loading shared libraries: libwebsockets.so.5: cannot open shared object file: No such file or directory"
Probably your libwebsocket file is located in the /usr/local/lib folder
Solution:
sudo ln -s /usr/local/lib/libwebsockets.so.5 /usr/lib/libwebsockets.so.5