Nonsense not to say, directly see the effect!




MQTT is a simple introduction to the details of the see, this article focuses on MQTT pit and local debugging!

MQTT in plain English:

  • MQTT is a long link protocol based on message topic/subscription transport for client and server two-way communication
  • Passing of time need to pass a url and port number to connect, format for: “TCP: / / broker. Emqx. IO: 1883”
  • When the client connects to the server, it passes a topic string, which is used to send messages to the server
  • When the server sends messages to the client, the client needs to subscribe() the server
  • Others:
    • ClientId // Identifies the user ID
    • MqttVersion // MQTT version number
    • IsAutomaticReconnect // Whether to reconnect
    • .

MAC Installation environment:

Terminal type command: brew Install mosquitto

Could eventually in the configuration of MQTT parameters: / usr/local/Cellar/mosquitto/version number/etc/mosquitto/mosquitto. Conf

Detailed configuration point me

MAC Download local debugging software

Download address

When the download is complete, it will look like this:

MQTTX local configuration

Then configure some parameters

MQTTandroid side of the code is everywhere on the Internet, so don’t waste your time, directly download to have a look at it.

MQTT download address

The last thing to note is that the server also subscribes to the topic, which must be filled in here

Walk here can complete the correspondence, go to try!

Android MQTT download address

MQTT local debugging tool download

MQTT environment configuration

Original is not easy, your praise is the biggest support for me!