Fix MQTT client ID mapping in MqttBackend (and derived classes) #15

Closed
opened 2022-07-05 01:38:39 +02:00 by blacklight · 0 comments
Owner

MqttBackend._get_client currently stores listeners in a <host, port, handler_id> mapping.

The problem with this approach is that client_id defaults to the current device/host name.

This means that two listeners that point to the same MQTT broker but subscribe to different sets of channels will have a client ID collision.

In order to prevent this issue, we need to generate a different client ID if a <host, port> pair already exists.

[`MqttBackend._get_client`](https://git.platypush.tech/platypush/platypush/-/blob/master/platypush/backend/mqtt/__init__.py#L258) currently stores listeners in a `<host, port, handler_id>` mapping. The problem with this approach is that `client_id` defaults to the current device/host name. This means that two listeners that point to the same MQTT broker but subscribe to different sets of channels will have a client ID collision. In order to prevent this issue, we need to generate a different client ID if a `<host, port>` pair already exists.
blacklight added the
bug
label 2022-07-05 01:38:39 +02:00
blacklight self-assigned this 2022-07-05 01:38:39 +02:00
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: platypush/platypush#15
No description provided.