Subscribe to the same topic multiple times and find problems

In practice, you should not subscribe to the same topic repeatedly, but try to subscribe to the same topic repeatedly in the test. If you find a problem, I am a beginner. Maybe it is not a problem. Looking forward to the answers.
The broker and topic needs to be changed to yours

Please explain what problem you are seeing, and export a small flow demonstrating the problem. Then we can import it and see if we can replicate it.

Please share this exact flow.

Also, please explain what you are attempting to achieve please.

The number is the execution order (click the execution order)
After step 3, the data can be received normally, but the received data is lost when subscribing again (4-step, 5-step). If the data is repeated again (6-step, 7-step), the received data is empty

[{"id":"eafbf2bd0cb1a911","type":"inject","z":"bef43d30cc72242e","name":"sub single string v1/devices/me/attributes/response/+","props":[{"p":"action","v":"subscribe","vt":"str"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"v1/devices/me/attributes/response/+","x":250,"y":1200,"wires":[["1bc939d3424e96b0"]]},{"id":"e8dff4a1a2332288","type":"comment","z":"bef43d30cc72242e","name":"Subscribe topics","info":"","x":120,"y":1160,"wires":[]},{"id":"60c93ad54211496a","type":"comment","z":"bef43d30cc72242e","name":"connect / disconnect / other","info":"","x":160,"y":960,"wires":[]},{"id":"4286c855f442a60a","type":"inject","z":"bef43d30cc72242e","name":"unsub all","props":[{"p":"action","v":"unsubscribe","vt":"str"},{"p":"topic","v":"true","vt":"bool"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":120,"y":1280,"wires":[["1bc939d3424e96b0"]]},{"id":"1bc939d3424e96b0","type":"mqtt in","z":"bef43d30cc72242e","name":"Dynamic 1","topic":"","qos":"2","datatype":"auto","broker":"d98ab0d0f2c84665","nl":false,"rap":true,"rh":0,"inputs":1,"x":560,"y":1200,"wires":[["ba7d968d025e1434"]]},{"id":"e568f02f852ae49b","type":"inject","z":"bef43d30cc72242e","name":"get subscriptions","props":[{"p":"action","v":"getSubscriptions","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":140,"y":1100,"wires":[["1bc939d3424e96b0"]]},{"id":"e52d5308b7f9bcf9","type":"complete","z":"bef43d30cc72242e","name":"","scope":["1bc939d3424e96b0"],"uncaught":false,"x":570,"y":1260,"wires":[["0f439578c36a5008"]]},{"id":"0f439578c36a5008","type":"debug","z":"bef43d30cc72242e","name":"Complete messages from dyn 1","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"true","targetType":"full","statusVal":"payload","statusType":"auto","x":810,"y":1260,"wires":[]},{"id":"414cc9a11b496a4f","type":"debug","z":"bef43d30cc72242e","name":"action response","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":780,"y":1140,"wires":[]},{"id":"ba7d968d025e1434","type":"switch","z":"bef43d30cc72242e","name":"has msg.action","property":"action","propertyType":"msg","rules":[{"t":"eq","v":"getSubscriptions","vt":"str"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":540,"y":1140,"wires":[["414cc9a11b496a4f"],["409d563946353ca3"]]},{"id":"409d563946353ca3","type":"debug","z":"bef43d30cc72242e","name":"MQTT messages dyn 1","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":830,"y":1200,"wires":[]},{"id":"6781fe8f9ee034d1","type":"inject","z":"bef43d30cc72242e","name":"connect with json","props":[{"p":"broker","v":"{\"broker\":\"thingsboard.cloud\",\"port\":1883,\"force\":true,\"username\":\"BSAPbKZ1a6bx8MkKbDWh\",\"protocolVersion\":5}","vt":"json"},{"p":"action","v":"connect","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":140,"y":1060,"wires":[["1bc939d3424e96b0"]]},{"id":"3dcadd366cc27acd","type":"inject","z":"bef43d30cc72242e","name":"v1/devices/me/attributes/request/1","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"v1/devices/me/attributes/request/1","payload":"{}","payloadType":"json","x":240,"y":1500,"wires":[["a18a861103436e0c"]]},{"id":"a18a861103436e0c","type":"mqtt out","z":"bef43d30cc72242e","name":"","topic":"","qos":"","retain":"","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"d98ab0d0f2c84665","x":510,"y":1460,"wires":[]},{"id":"903741c1c11402fb","type":"comment","z":"bef43d30cc72242e","name":"publish to regular mqtt out","info":"","x":150,"y":1460,"wires":[]},{"id":"4f8034d0227e584a","type":"inject","z":"bef43d30cc72242e","name":"disconnect","props":[{"p":"action","v":"disconnect","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":160,"y":1420,"wires":[["a18a861103436e0c"]]},{"id":"719be51b1cd86bc9","type":"complete","z":"bef43d30cc72242e","name":"","scope":["a18a861103436e0c"],"uncaught":false,"x":710,"y":1420,"wires":[["abc50b92610133e7"]]},{"id":"a76d844dc80ac6a0","type":"debug","z":"bef43d30cc72242e","name":"Complete messages mqtt-out","active":false,"tosidebar":true,"console":false,"tostatus":true,"complete":"true","targetType":"full","statusVal":"payload","statusType":"msg","x":780,"y":1500,"wires":[]},{"id":"ae2413b34f94726e","type":"comment","z":"bef43d30cc72242e","name":"Testing connect / disconnect actions with an mqtt-out","info":"","x":230,"y":1380,"wires":[]},{"id":"abc50b92610133e7","type":"switch","z":"bef43d30cc72242e","name":"has msg.action","property":"action","propertyType":"msg","rules":[{"t":"nnull"}],"checkall":"true","repair":false,"outputs":1,"x":720,"y":1460,"wires":[["a76d844dc80ac6a0"]]},{"id":"d45b360505a4c0d2","type":"inject","z":"bef43d30cc72242e","name":"disconnect","props":[{"p":"action","v":"disconnect","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":120,"y":1020,"wires":[["1bc939d3424e96b0"]]},{"id":"e83d1023f7bc72e3","type":"comment","z":"bef43d30cc72242e","name":"Unsubscribe topics","info":"","x":130,"y":1240,"wires":[]},{"id":"d98ab0d0f2c84665","type":"mqtt-broker","name":"broker_to_test_mqtt_control","broker":"localhost","port":"1883","clientid":"","autoConnect":false,"usetls":false,"protocolVersion":"4","keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","birthMsg":{},"closeTopic":"","closeQos":"0","closePayload":"","closeMsg":{},"willTopic":"","willQos":"0","willPayload":"","willMsg":{},"sessionExpiry":""}]

Several more brokers are provided for testing by multiple people, which may not be connected to the broker
{
"broker": "thingsboard.cloud",
"port": 1883,
"force": true,
"username": "2pbCdh3BI8SbsKD2iWzb",
"protocolVersion": 5
}

username guZYLGYDty9n51y0tYvx

GIF 2022-11-6 22-14-12

Are they using the same client id, try leaving it blank in the broker

Hi. I will check this but could you verify your what is ACTUALLY coming from broker by using an independent client?

As you seem to be using MQTT v5 then I suggest MQTT X as it supports v5.

Use a separate client to subscribe to topics v1/devices/me/attributes/request/1 and v1/devices/me/attributes/response/1 & compare that to the debug value you see in Node-RED.

I confirm that thingboard is normal,I try unsub all, and then sub, and there will be no data or partial data.

In theory, the same client ID, no matter how many times you subscribe to the same topic, should also be the same topic, and the results should be normal. I'm a novice, maybe the description is wrong.You can try to change the sub to your business address

How did you confirm this?
Can you show screenshots?

Are you using feature of MQTT v5? If not could you retest using v3.1? (protocolVersion = 4)

I also tried the flow & sequence of operation with a mosquito broker - it works perfectly.

Your guess is correct. thingsboard's protocol is v3. Because of my carelessness, I connected v3 with v5. Thank you.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.