Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在使用mosquitto 客户端开发 PHP 项目,我需要检查某些用户何时断开连接并识别用户。
我正在使用仅包含断开连接原因的代码回调函数。
onDisconnect($callback)
函数,以便我可以处理断开连接事件。
如何将事件链接到数据库中的用户。
谢谢,
该回调表示您的客户端已断开连接,而不是其他客户端(这可能是您所说的“用户”)。只有在以下情况下,您才能知道另一个客户端已断开连接
当然,在这两种情况下,您的客户都必须订阅相关主题。