eclipse / paho.mqtt.testing

An Eclipse Paho project - a Python broker for testing
https://eclipse.org/paho
Other
108 stars 73 forks source link

MQTTv5: Overlapped subscriptions considered cross client #56

Closed mauricek closed 6 years ago

mauricek commented 6 years ago

Consider the following setup:

When a message on topic foo is published from another client, the standard says: " If the Server sends a single copy of the message it MUST include in the PUBLISH packet the Subscription Identifiers for all matching
subscriptions which have a Subscription Identifiers, their order is not significant [MQTT-3.3.4-4].
If the Server sends multiple PUBLISH packets it MUST send, in each of
them, the Subscription Identifier of the matching subscription if it has a Subscription Identifier [MQTT-3.3.4-5].
"

This is true for Client B, with paho.mqtt.testing it receives a PUBLISH with the ids 2 and 3 to indicate the overlap. subA also receives the message. However, there is contains the ids 1, 2 and 3, meaning the IDs of a separate client.

Overlapped subscriptions should be understood as per client instance, not over the whole subscription space. Especially as multiple clients could use the same ids.

Expected result:

Alternatively (as done on other MQTT5 implementations)

Actual result:

icraggs commented 6 years ago

Thanks, I've added a fix and a test.

mauricek commented 6 years ago

Works nicely. Thank you.