New websocket software example
Hi, I've been using ThingSpeak now for a number of years capturing temperature data from a Pi zero and Python. I currently use the Unsecured TCP option, but the recent email about moving to mqtt3 server suggests websockets. I've looked at the example and understand username, password and channel ID, but not what the Client ID is. Can someone tell me what this is please.
Many thanks Alastair
2 Comments
Time DescendingMQTT Brokers need to keep track of each connected device in order to properly route messages to and from it. Brokers use ClientId to uniquely identify an MQTT connection for this purpose.
For example, if you own 3 Pi Zeros, each of them must use a unique ClientId. Otherwise, the Pi Zeros will be like three people trying to share one chair. Each time someone sits down, the other two are forced to stand. Similarly, the Pi Zeros will continually disconnect and reconnect.
When you add a device to your MQTT Devices, ThingSpeak generates a unique ClientId for it. You'll also get a unique username and password for that device.
It may be confusing that both Username and ClientId are required to connect; this is sort of just a quirk of the MQTT protocol.
Further Reading