未知的配置变量“协议”错误mosquitto

时间:2015-12-31 07:36:34

标签: mqtt mosquitto

我使用 tcp websocket 为mqtt配置mosquitto。使用以下链接的步骤,

http://www.xappsoftware.com/wordpress/2015/05/18/six-steps-to-install-mosquitto-1-4-2-with-websockets-on-debian-wheezy/comment-page-1/

tcp工作正常。

但websocket无效。

我将以下行添加到 mosquitto.conf

port 1883
listener 9001
protocol websockets**

我在mosquitto.conf文件中评论 protocol websockets 行,mosquitto工作正常。否则我收到错误未知配置变量“协议”。 我想知道是否需要执行任何证书文件。 请帮帮我........

3 个答案:

答案 0 :(得分:1)

只有在1.4之前使用了mosquitto版本时才会出现此错误。如果您已安装1.4.x但未使用websockets支持进行编译,则会收到错误

Error: Websockets support not available.

检查您的版本。

答案 1 :(得分:1)


    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

答案 2 :(得分:0)

你确定你用websocket编译了mosquitto吗?

首先应安装libwebsocket,然后在WITH_WEBSOCKETS中重新编译mosquitto:= yes