MQTT是 Message Queuing Telemetry Transport,消息队列遥测传输。是IBM开发的IOT 轻量级消息订阅和发布的协议。
学习对MQTT的理解,可以选用已实现这个协议的broker,比如Mosquitto.
这里介绍Mosquitto的安装与使用
1. 安装 homebrew
curl -fsSL -o install.sh https://raw.githubusercontent.com/Homebrew/install/master/install.sh
/bin/bash install.sh
2. Install Mosquitto
brew install mosquitto
3. Start the Mosquitto
/usr/local/sbin/mosquitto -c /usr/local/etc/mosquitto/mosquitto.conf
1614326231: mosquitto version 2.0.7 starting
1614326231: Using default config.
1614326231: Starting in local only mode. Connections will only be possible from clients running on this machine.
1614326231: Create a configuration file which defines a listener to allow remote access.
1614326231: Opening ipv4 listen socket on port 1883.