Mosquitto 1.4.2 Websocket support

匿名 (未验证) 提交于 2019-12-03 02:29:01

问题:

I'm trying to utilize Mosquittos recent update to support websockets in the broker. I'm running Mosquitto v1.4.2 and I've added the following lines to the mosquitto configuration file (mosquitto.conf):

listener 10001 127.0.0.1 protocol websockets  listener 1883 protocol mqtt 

When I try and start the broker with the new configuration I get the following :

$ mosquitto -c /etc/mosquitto/mosquitto.conf Error: Websockets support not available. Error found at /etc/mosquitto/mosquitto.conf:16. Error: Unable to open configuration file. 

I was under the assumption that version 1.4 and above of Mosquitto has websocket support now (don't have to build from source to enable websocket support like you had to before v1.4) so I'm wondering what I'm missing. Any help on what direction to look to troubleshoot the problem is appreciated.

Edit: Forgot to mention I'm running CentOS6

回答1:

While the 1.4.x codebase includes Websocket support it has to be enabled at build time and relies on the libwebsocket library.

The builds currently available in the RedHat/Fedora yum repos do not have Webosockets enabled as there is no libwebsocket package available. I assume CentOS is using the same srpms.

See this bugzilla enrty for details: https://bugzilla.redhat.com/show_bug.cgi?id=1197678



回答2:

you can modify config.mk like this

in config.mk

# Build with websockets support on the broker. WITH_WEBSOCKETS:=yes 

then can you use a config parameter

listener 10001 127.0.0.1 protocol websockets 


回答3:

In the dir mosquitto-1.4.X edit the file config.mk:

# Build with websockets support on the broker. WITH_WEBSOCKETS:=yes 

Then run in the dir mosquitto-1.4.X

make sudo make install 

Edit the configurations /etc/mosquitto/mosquitto.conf

listener 10001 127.0.0.1 protcol websockets 

And restart

mosquitto -c /etc/mosquitto/mosquitto.conf 


标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!