Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cleansession=false,无法接受离线消息 #89

Open
SSFG1992 opened this issue Aug 10, 2023 · 0 comments
Open

cleansession=false,无法接受离线消息 #89

SSFG1992 opened this issue Aug 10, 2023 · 0 comments

Comments

@SSFG1992
Copy link

利用https://jiejietop.gitee.io/mqtt/index.html提供的代码生成工具,生成一个订阅客户端,cleanssion=false。
情况1:
这个程序成功运行后可以收到发布的消息,ctrl+c退出后,再重新执行,无法收到退出期间发布的消息。(ps:mosquito在这种测试下是可以收到退出期间发布的消息)
情况2:
这个程序成功运行后可以收到发布的消息,断开网络(程序继续执行),再重连网络,可以收到断网期间发布的消息。

我看了源码,断网重连和执行程序后首次连接似乎是一样的流程,都是先执行mqtt_connect再执行mqtt_subscribe。为何情况1收不到离线消息呢?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant