ESA2GJK1DH1K Basics: MQTT communication on major Internet of Things platform

 

 

 

Foreword

  This section is slightly nagging point

  In fact, I do not have a very long tutorial how things connect ready-made platform,

  Has been written to teach you to build their own server, the main reason is because I feel connected to the existing learn anything.

  Now out of this tutorial, because really found a lot of people like to use.

  But you look at it! Connect the existing very simple

  In fact, I do not understand is: This online tutorial !!!! everywhere and the price is set high, just like the same as on how tall ......

  

nagging

  Say something, we connect my server when needed MQTT

    ClientID: their own free setting (if my program is using a Wi-Fi: using its MAC address; if the GPRS: using its IMEI)

    Username: Username MQTT of the installation I set the yang

    Password: password when installing the QMTT I set 11223344

    IP Address: IP address is 47.92.31.46 my server or domain name mnif.cn

    Port a variety of connections my MQTT server: port number

          TCP: mnifdv.cn:1883
          SSL: mnif.cn: 8883
          WS: mnif.cn:8083
          WSS mnif.cn:8084
          micro letter applet: wss:? // mnif.cn/mqtt?

    Then subscribe and publish themes (free to set their own)

 

  First we need to know MQTT software supports dynamic setting those above, you can add more.

  If you also want to be like Ali cloud, OneNet, wit cloud platform and other things

  Then start the database MQTT plug, and then fill out the dynamics of the above information and delete those

  Remember Ha, user name, password, subscription and publication of a number of themes can be set

  It allows each user is different.

 

  其实要连接各大物联网平台平台再怎么变也离不开上面那些.但是呢!大家想一件事情

  如果仅仅像我似的安装个MQTT,然后告诉大家上面那些信息,然后开放性的提供给大家

 

  问题1. ClientID 或者 设置每个用户连接的MQTT IP地址不一样

    1.1 ClientID

      本身MQTT服务器就规定每个设备的ClientID必须不能一样

      如果一样 MQTT服务器就会把相同的踢掉.

      如果有用户定义的一样,岂不是造成 设备经常掉线

      所以有的自行给你规定了ClientID

    1.2 设置连接的IP地址不一样

      IP地址不一样便使得每个用户通信不受干扰

 

  问题2. 订阅和发布的主题

    1.如果出现一个用户和另一个用户的订阅和发布的主题一样,那么消息就混了

               2.主题一般都是  固定/自己可以改变

      大家知不知道如果订阅     固定/#     便可监听所有设备的数据

 

  问题3. 为什么可以在平台看到数据

    各大物联网平台本身就是网页,网页也可以连接MQTT呀!

    只要网页上设置好订阅的主题是你发布的主题,不就完事了!

 

    想知道网页实现MQTT:升级篇正好安装了Web服务器,教给大家网页实现MQTT控制设备正合适.

    

 

 

 

 

  问题4. 暂无

 

 

 

 

 

 

 

 

结语

  然后就是在平台上按照规定的流程去操作,然后就会获取到上面的那些信息,

  或者说给你一些其它信息告诉你这几个信息如何组合成上面的ClientID,用户名,密码,订阅发布的主题

  然后就可以通信了.

  我出的教程要保证大家: 不仅要知其然,还要知其所以然!

  透彻的知晓整个过程是每一个做项目人员必须的,我这个人最讨厌: 糊弄

  要是对自己做的东西不够全部知晓,出了问题就是麻烦的事情了!!!!!!

 

    

   

Guess you like

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