MQTT – Connect to Mosquitto broker on local Windows machine
To test MQTT on local machine, install Mosquitto MQTT broker on the local machine.
C:\Program Files\mosquitto>mosquitto -v
1556603096: mosquitto version 1.6.0 starting
1556603096: Using default config.
1556603096: Opening ipv6 listen socket on port 1883.
1556603096: Opening ipv4 listen socket on port 1883.
Related Topics
- How MQTT works?
- MQTT – Connect to Broker
- MQTT Topics
- MQTT Publish
- MQTT Subscribe
- MQTT Quality of Service (QoS)
- MQTT – Keep Alive with PINGREQ and PINGRESP
- Install MQTT broker Mosquitto in Windows
- Mosquitto Broker – Enable user authentication
- MQTT Broker connection with user name and password
Using the AT Command Tester tool, connect to the Mosquitto server on the localhost.
Connection request from the AT Command Tester tool is acknowledged by the Mosquitto server.
1556603365: New connection from 127.0.0.1 on port 1883.
1556603365: New client connected from 127.0.0.1 as 5470 (p2, c1, k60).
1556603365: No will message specified.
1556603365: Sending CONNACK to 5470 (0, 0)
Once the connection is up, the MQTT server will periodically respond to clients PING requests.
1556603425: Received PINGREQ from 5470
1556603425: Sending PINGRESP to 5470
1556603485: Received PINGREQ from 5470
1556603485: Sending PINGRESP to 5470
1556603545: Received PINGREQ from 5470
1556603545: Sending PINGRESP to 5470
When the client disconnects, MQTT broker will terminate the connection.
1556603593: Received DISCONNECT from 5470
1556603593: Client 5470 disconnected.