MQTT subscribe retrieves no data back after immediate reply

조회 수: 1 (최근 30일)
Jason Wu
Jason Wu 2021년 5월 21일
댓글: Vinod 2021년 5월 29일
Dear Sirs,
I am student in university, new in MQTT, used MQTTlens and MQTT.fx as the client.
Used them to subscribe the public channel "1293177", the channel publish weather data frequently.
But, only got the first record immediately after subscribe, and no more.
If subscribe again, will got the same record again.
I follow the article at https://www.mathworks.com/help/thingspeak/troubleshoot-MQTT-subscribe.html and without mismatch.
Would you kindly help to figure out the problem is?
  댓글 수: 2
Vinod
Vinod 2021년 5월 25일
Do you have multiple clients connected using the same ClientID?
How many concurrent MQTTFx clients do you have using the same MQTT API Key?
Jason Wu
Jason Wu 2021년 5월 26일
One, only one client at the same time. The purpose is to experience about the subscribe effect. Unfortunately, it not work.

댓글을 달려면 로그인하십시오.

답변 (1개)

Vinod
Vinod 2021년 5월 27일
I just tested the workflow with MQTT.fx and it works fine. Some points to remember:
1) When setting up the connection, set the "Password" to the "MQTT API Key" from your ThingSpeak profile page
2) When subscribing to a channel, the topic must be: channels/<CHANNEL_ID>/subscribe/json/<CHANNEL_READ_API_KEY>
3) Now publish "field1=45" to this channel using this topic: channels/<CHANNEL_ID>/publish/<CHANNEL_WRITE_API_KEY>
For every publish at 15s or slower (with a free license) you should also see that a subscribe message is received.
  댓글 수: 2
Jason Wu
Jason Wu 2021년 5월 29일
Dear Vinod,
Thanks for your suggestion. Since all checked before my issue. Not only MQTT.fx but also MQTTLens are the same. Got the first record immediately, may be the LWT by channel "1293177".
regards,
Vinod
Vinod 2021년 5월 29일
Can you share screenshots of the mqttfx application with your settings. Clearly some misconfiguration as it works perfectly fine for me.

댓글을 달려면 로그인하십시오.

커뮤니티

더 많은 답변 보기:  ThingSpeak 커뮤니티

카테고리

Help CenterFile Exchange에서 MQTT API에 대해 자세히 알아보기

제품


릴리스

R2021a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by