eclipse-paho / eclipse-paho/paho.mqtt.python

Receiving retained message twice on subscription to multiple topics with one subscribe call

Open
#878 1 comment 0 reactions 0 assignees View on GitHub
Status: Available
Dominant language
Python
Stars
2.4k
Forks
742
Avg merge
12d 48m
Merged PRs (30d)
1

Description

Hello,

I am running paho-mqtt version: 2.1.0 with Python 3.10.12

a = [("shellyplusuni-a0a3b366fd80/#", SubscribeOptions(qos=2)), ("v1/#", SubscribeOptions(qos=2))]
mqtt_client.subscribe(a)

**Subscription with message ID 1: [ReasonCode(Suback, 'Granted QoS 2'), ReasonCode(Suback, 'Granted QoS 2')]**
shellyplusuni-a0a3b366fd80 is online
**Subscription with message ID 2: [ReasonCode(Suback, 'Granted QoS 2'), ReasonCode(Suback, 'Granted QoS 2')]**
shellyplusuni-a0a3b366fd80 is online

Is this expected? I am receiving "shellyplusuni-a0a3b366fd80 is online" twice, which is an output of my on_message handler (this is a retained message within this topic). Topics are not overlapping. I would expect two message IDs, 1 and 2. However, both have the same reason code list.

With two subscribe calls (one topic each), I get:

Subscription with message ID 1: [ReasonCode(Suback, 'Granted QoS 2')]
shellyplusuni-a0a3b366fd80 is online
Subscription with message ID 2: [ReasonCode(Suback, 'Granted QoS 2')]

I would expect exactly the same output when calling subscribe with multiple topics.

Thanks,
Robert

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.