How To Implement Paho Python Client In Django 3.1
from this SO question, I implemented a subscriber client in my Django project as following: in mqtt.py, I create a client and connect to a local broker and subscribe to a topic. #m
Solution 1:
I had a similar problem after following a similar setup as to what you have, here: https://stackoverflow.com/a/41017210/13001393
The resolution for the repeated connection was due to a setting on the MQTT server where the user name is set as the clientid.
mosquitto.conf
# Set use_username_as_clientid to true to replace the clientid that a client
# connected with with its username. This allows authentication to be tied to
# the clientid, which means that it is possible to prevent one client
# disconnecting another by using the same clientid.
# If a client connects with no username it will be disconnected as not
# authorised when this option is set to true.
# Do not use in conjunction with clientid_prefixes.
# See also use_identity_as_username.
use_username_as_clientid true
You may want to check that setting. and make sure that you are using different usernames for each mqtt client.
Post a Comment for "How To Implement Paho Python Client In Django 3.1"