【问题标题】:Mosquitto 1.4.2 Websocket supportMosquitto 1.4.2 Websocket 支持
【发布时间】:2015-08-03 17:05:48
【问题描述】:

我正在尝试利用 Mosquittos 最近的更新来支持代理中的 websocket。我正在运行 Mosquitto v1.4.2,并且在 mosquitto 配置文件 (mosquitto.conf) 中添加了以下几行:

listener 10001 127.0.0.1
protocol websockets

listener 1883
protocol mqtt

当我尝试使用新配置启动代理时,我得到以下信息:

$ 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.

我假设 Mosquitto 的 1.4 及更高版本现在具有 websocket 支持(不必像 v1.4 之前那样从源代码构建来启用 websocket 支持)所以我想知道我是什么失踪。任何有关解决问题的方向的帮助表示赞赏。

编辑:忘了说我正在运行 CentOS6

【问题讨论】:

    标签: websocket mqtt iot broker mosquitto


    【解决方案1】:

    虽然 1.4.x 代码库包含 Websocket 支持,但它必须在构建时启用并依赖于 libwebsocket 库。

    RedHat/Fedora yum 存储库中当前可用的构建没有启用 Webosockets,因为没有可用的 libwebsocket 包。我假设 CentOS 使用相同的 srpm。

    有关详细信息,请参阅此 bugzilla enrty:https://bugzilla.redhat.com/show_bug.cgi?id=1197678

    【讨论】:

      【解决方案2】:

      你可以像这样修改config.mk

      在 config.mk 中

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

      那么你可以使用配置参数吗

      listener 10001 127.0.0.1
      protocol websockets
      

      【讨论】:

      • 你能解释一下这些步骤吗
      • 我的 Paho Javascript 客户端和我在本地主机上设置的代理也遇到了类似的问题,但我按照这些步骤操作,它对我有用 github.com/bapowell/bapowell.github.io/wiki/…,但这适用于 Windows,但也许它可以帮助你
      • 我尝试了这些,但它不起作用,是我缺少什么吗?
      • 用yum安装的时候怎么办?
      【解决方案3】:

      在目录 mosquitto-1.4.X 编辑文件 config.mk:

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

      然后在目录 mosquitto-1.4.X 中运行

      make
      sudo make install
      

      编辑配置/etc/mosquitto/mosquitto.conf

      listener 10001 127.0.0.1
      protcol websockets
      

      然后重启

      mosquitto -c /etc/mosquitto/mosquitto.conf
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2019-04-17
        • 1970-01-01
        • 2013-05-10
        • 2018-02-02
        • 1970-01-01
        • 1970-01-01
        • 2018-07-24
        相关资源
        最近更新 更多