当前位置:网站首页>Learning Tai Chi Maker - mqtt Chapter II (VI) mqtt wills
Learning Tai Chi Maker - mqtt Chapter II (VI) mqtt wills
2022-06-28 04:55:00 【xuechanba】
Video link : https://www.bilibili.com/video/BV1B54y1t7j5/?spm_id_from=autoNext&vd_source=b91967c499b23106586d7aa35af46413
The data link :http://www.taichi-maker.com/homepage/esp8266-nodemcu-iot/iot-tuttorial/mqtt-tutorial/mqtt-last-will/


When the client disconnects normally , Will send to the server DISCONNECT message , After the server receives the message , You know , The client is disconnected normally , Instead of accidentally disconnecting .

However , When the server does not receive DISCONNECT In the case of messages , Discover clients “ heartbeat ” Stopped. , At this time, the server knows that the client is disconnected accidentally .
Give another example through the client software :
When connected normally ,

When you click Disconnect after , This is software ( client ) Will go to MQTT Server sends a DISCONNECT Data packets , In this case , The server knows that the client is disconnected normally . However , If I close the software directly or the computer shuts down accidentally , here , Software ( client ) I won't go to MQTT Server send DISCONNECT Data packets , That is to say, as long as the client does not MQTT Server send DISCONNECT Data packets , This is an accidental disconnection .

( Only clients that have subscribed to the will can receive the will information when the published client accidentally disconnects .)
1、 How the client sends the will message to the server


Pass below MQTT.fx This software is used to operate how to use MQTT will ,
First , Click on the gear



After setting up , Click on OK , It's set up .
below , Let's open another one MQTT.fx Software , Subscribe to the topics published by the above client as a client , But there is a very important step , That's it
1、 Delete the contents of the will set before , Because it is subscribed as a client , So there is no need for these contents .

2、 Click regenerate Client ID, It's very important .

after , Click on OK, It's set up .

Now? , We accidentally disconnected the client that issued the will ( Close the software directly ), See what happens .

If the will retention information is checked , What kind of result will happen ?
First open a software and set it ,

Open another software ( It is the same as the setting for opening another software mentioned above )
after , We accidentally disconnected the client that issued the will ( Close the software directly ), See what happens .
Will also receive information about wills .
Now? , Open another software ( The settings are the same , Mainly regenerate ClientID), Then click to subscribe to the will topic .
You will find that you have received the will information immediately .

And if the connection was normally disconnected before ?
When the connection is normally disconnected, it will not send , When other clients subscribe to the will information , I will receive the reserved wills immediately , Instead of waiting until you accidentally disconnect .
Last , Let's talk about it MQTT Will operation suggestions

( How to demonstrate , I'll introduce it later )
边栏推荐
- Generate QR code in wechat applet
- lotus v1.16.0 calibnet
- 多线程实现 重写run(),怎么注入使用mapper文件操作数据库
- 【Matlab红绿灯识别】红绿灯识别【含GUI源码 1908期】
- Matlab exercises -- routine operation of matrix
- Mise en place d'un cadre d'essai d'automatisation de l'interface utilisateur - - rédaction d'une application d'automatisation
- 灵活的IP网络测试工具——— X-Launch
- 2022电力电缆判断题模拟考试平台操作
- 学习太极创客 — MQTT 第二章(五)心跳机制
- mysql导入文本文件时的pager
猜你喜欢

The growth summer challenge is coming | learn and create two major tracks, and start the tutor registration!

浅析搭建视频监控汇聚平台的必要性及场景应用

2022年G3锅炉水处理复训题库模拟考试平台操作

Huawei's 9-year experience as a software testing director

27 years, Microsoft IE is over!

Light collector, Yunnan Baiyao!

2022年低压电工考题及答案

Google Earth Engine(GEE)——全球洪水数据库 v1 (2000-2018年)

Matlab exercises -- basic data processing

大促场景下,如何做好网关高可用防护
随机推荐
The growth summer challenge is coming | learn and create two major tracks, and start the tutor registration!
2022年最新辽宁建筑八大员(标准员)考试试题及答案
Role of native keyword
S32ds jump to defaultisr
native关键字的作用
Oracledata installation problems
学习太极创客 — MQTT 第二章(六)MQTT 遗嘱
mysql导入文本文件时的pager
【Matlab红绿灯识别】红绿灯识别【含GUI源码 1908期】
Notepad++ -- column editing mode -- Usage / instance
On the necessity of building a video surveillance convergence platform and its scenario application
Generate QR code in wechat applet
Idle interrupt cannot be cleared
Flinkcdc collects Oracle, and the Oracle database is CDB's
Difference between curdate() and now()
A doctor's 22 years in Huawei (full of dry goods)
2022年安全员-B证考试题库及答案
使用class toplevel的messagebox时,窗口弹出问题。
Binary sort tree: BST
Unity delegate