mosquitto

mosquitto #

eclipse/mosquitto Github stars Github forks Language Last Tag Last commit

物联网(Internet of Things,IoT)最近曝光率越来越高。虽然 HTTP 是网页的事实标准,不过机器之间(Machine-to-Machine,M2M)的大规模沟通需要不同的模式:之前的请求 / 回答(Request/Response)模式不再合适,取而代之的是发布 / 订阅(Publish/Subscribe)模式。这就是轻量级、可扩展的 MQTT(Message Queuing Telemetry Transport)可以施展拳脚的舞台。

MQTT 是基于二进制消息的发布 / 订阅编程模式的消息协议,最早由 IBM 提出的,如今已经成为 OASIS 规范。由于规范很简单,非常适合需要低功耗和网络带宽有限的 IoT 场景,比如:

  • 遥感数据
  • 汽车
  • 智能家居
  • 智慧城市
  • 医疗医护

mosquitto_pub #

mosquitto_pub {[-h host] [-p port] [-u username] [-P password] -t topic | -L URL}
                     {-f file | -l | -n | -m message}
                     [-c] [-k keepalive] [-q qos] [-r] [--repeat N] [--repeat-delay time]
                     [-A bind_address]
                     [-i id] [-I id_prefix]
                     [-d] [--quiet]
                     [-M max_inflight]
                     [-u username [-P password]]
                     [--will-topic [--will-payload payload] [--will-qos qos] [--will-retain]]
                     [{--cafile file | --capath dir} [--cert file] [--key file]
                       [--ciphers ciphers] [--insecure]
                       [--tls-alpn protocol]
                       [--tls-engine engine] [--keyform keyform] [--tls-engine-kpass-sha1]]
                     [--psk hex-key --psk-identity identity [--ciphers ciphers]]
                     [--proxy socks-url]
                     [--property command identifier value]
                     [-D command identifier value]

mosquitto_pub -t ‘application/1/device/ffffff100000d143/rx’ -m ‘{“applicationID”:“1”,“applicationName”:“0000000000000001”,“deviceName”:“d143-K5-out”,“devEUI”:“ffffff100000d143”,“txInfo”:{“frequency”:481700000,“dr”:2},“adr”:false,“fCnt”:68570,“fPort”:44,“data”:“BQEA”}’

mosquitto_pub -t ‘application/1/device/ffffff100000d143/rx’ -m ‘{“applicationID”:“1”}’

mosquitto_sub #

mosquitto_sub -t ‘application/1/device/ffffff100000d143/rx’ mosquitto_sub -h 120.241.124.226 -t ‘application/1/device/ffffff100000d143/rx’

安装 #

MacOS #

brew install mosquitto

参考:https://mosquitto.org/download/


本文访问量

本站总访问量

本站总访客数