当前位置:网站首页>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 )
边栏推荐
- CUPTI error: CUPTI could not be loaded or symbol could not be found.
- UI自动化测试框架搭建 —— 编写一个APP自动化
- flinkcdc采集oracle,oracle数据库是CDB的
- C语言全局变量(c文件和h文件中的全局变量、静态全局变量)使用注意事项
- 2022新版nft源码中国元宇宙数字藏品艺术品交易平台源码
- Flinkcdc collects Oracle, and the Oracle database is CDB's
- lotus v1.16.0 calibnet
- Matlab exercises -- basic data processing
- Sword finger offer 53 - I. find the number I in the sorted array (improved bisection)
- How to clean the nozzle of Epson l3153 printer
猜你喜欢
玩转双指针
Blocking, non blocking, IO multiplexing select\poll\epoll
机器人学DH参数及利用matlab符号运算推导
Sword finger offer 47 Maximum gift value (DP)
2022新版nft源码中国元宇宙数字藏品艺术品交易平台源码
【牛客网刷题系列 之 Verilog快速入门】~ 四选一多路器
100+ data science interview questions and answers Summary - machine learning and deep learning
On the necessity of building a video surveillance convergence platform and its scenario application
[noip2002 popularization group] cross the river pawn
The growth summer challenge is coming | learn and create two major tracks, and start the tutor registration!
随机推荐
The growth summer challenge is coming | learn and create two major tracks, and start the tutor registration!
UI automation test framework construction - write an app automation
100+ data science interview questions and answers Summary - machine learning and deep learning
【Proteus仿真】定时器1外部计数中断
Standard particle swarm optimization C language program
汇编常用指令
flinkcdc采集oracle,oracle数据库是CDB的
June 27, 2022: give a 01 string with a length of N. now please find two intervals so that the number of 1 and the number of 0 in the two intervals are equal. The two intervals can intersect, but not c
[NOIP2002 普及组] 过河卒
Distributed transaction - Final consistency scheme based on message compensation (local message table, message queue)
公司为什么选择云数据库?它的魅力到底是什么!
The second round of free public classes of the red team is coming ~ 8:00 tomorrow night!
OracleData安装问题
27 years, Microsoft IE is over!
[matlab traffic light identification] traffic light identification [including GUI source code 1908]
Taco: a data enhancement technique for character recognition
【Matlab红绿灯识别】红绿灯识别【含GUI源码 1908期】
Sword finger offer 53 - I. find the number I in the sorted array (improved bisection)
Congratulations to myself, official account has more than ten thousand fans
On the necessity of building a video surveillance convergence platform and its scenario application