Programming small micro-channel ESA2GJK1DH1K: MQTT simple connection applet Demo

 

 

 

 

Foreword

  This section let everyone know how the applet is connected MQTT

  In fact, the applet page is achieved MQTT

  Using the following package

  

 

 

  

Create a new project

  A, inside the bag into util

 

       

 

 

  Second, the function to write connection

    

 

 

  Third, the call connection function

 

    

 

 

 

 

 

 

 

Subscribe to topics display the received message

  First, the connection is successful subscribe to topics 111111

  

 

 

 

 

  Second, when the connection is provided MQTT callback function receives data

 

  

 

 

 

 

 

test

  

 

 

send data

  222222 issued by the theme of the message sent to receive messages

  

 

 

 

test

 

 

Guess you like

Origin www.cnblogs.com/yangfengwu/p/11824096.html