Reputation: 56
I am configure mosquitto for mqtt with tcp and websocket. using steps of below link,
tcp is working good.
but websocket is not working.
I add below lines to mosquitto.conf,
port 1883
listener 9001
protocol websockets**
I comment protocol websockets line from mosquitto.conf file, the mosquitto is working good.Otherwise i got error Unknown configuration variable "protocol". I want know if any certificate file need to execute this. Please help me out........
Upvotes: 2
Views: 2928
Reputation: 271
yum install c-ares-devel libuuid-devel openssl-devel -y # if you don't want to install dependencies, open config.mk, # modify WITH_TLS:=no、WITH_TLS_PSK:=no、WITH_UUID:=no、WITH_SRV:=no # download mosquitto 1.4.7 wget http://mosquitto.org/files/source/mosquitto-1.4.7.tar.gz tar xzf mosquitto-1.4.7.tar.gz # download libwebsocket wget http://git.libwebsockets.org/cgi-bin/cgit/libwebsockets/snapshot/libwebsockets-1.6.0-chrome48-firefox42.tar.gz # compile and install libwebsocket cd libwebsockets-1.6.0-chrome48-firefox42 mkdir build cd build cmake .. -DLIB_SUFFIX=64 sudo make install ln -s /usr/local/lib64/libwebsockets.so.6 /lib64/libwebsockets.so.6 # compile end # compile mosquitto cd ../../mosquitto-1.4.7 make # compile end # vim mosquitto.conf # line 275 add listener 8000 # line 295 add protocol websockets # add mosquitto user groupadd mosquitto useradd -s /sbin/nologin mosquitto -g mosquitto -d /var/lib/mosquitto # make sure kill any program use 1883 and 8000 src/mosquitto -c mosquitto.conf
Ubuntu
apt-get install cmake git zlib1g.dev libssl-dev cd libwebsockets-1.6.0-chrome48-firefox42 mkdir build cd build cmake .. -DLIB_SUFFIX=64 sudo make install ln -s /usr/local/lib64/libwebsockets.so.6 /lib/libwebsockets.so.6 cd mosquitto-1.4.7 make # line 136 uncomment port 1883 # line 275 listener 8000 # line 295 protocol websockets
Upvotes: 1
Reputation: 11608
This error will only occur if you have used a version of mosquitto prior to 1.4. If you have installed 1.4.x but not compiled with websockets support, you will receive the error
Error: Websockets support not available.
Check what version you have.
Upvotes: 1
Reputation: 271
Are you sure you compiled mosquitto with websocket ??
You should install libwebsocket first, and recompile mosquitto with in WITH_WEBSOCKETS:=yes
Upvotes: 0