为什么在onju connect之前调用on\u publish回调?

2024-09-25 06:31:13 发布

您现在位置:Python中文网/ 问答频道 /正文

我编写的代码的输出是

on_publish
('Connected', '0')
('message received ', 'test1234')
('message topic=', u'paho/test')

代码如下:

^{pr2}$

Tags: 代码testmessagetopiconpublishpahoreceived
1条回答
网友
1楼 · 发布于 2024-09-25 06:31:13

将对subscribepublish的调用移动到on_connect回调中,然后在尝试订阅主题和发布消息之前,可以确保连接成功。在

如果经纪人出了问题,其他任何事情都会失败。在

相关问题 更多 >