0

I just wanted to know on how MQTT broker identifies different MQTT clients hardware, as I understand MQTT clients are not assigned any IP addresses unlike web clients yet communicate over internet at ease.

4
  • Can you provide a link to where you are reading that? There are some protocols like ESPNow that violate TCP/IP but are still passed through Ethernet equipment. But I don't think MQTT is one of those. Commented Apr 28 at 12:36
  • While there are variations of MQTT (like MQTT-SN) which can be used over BLE or Zigbee for instance, the "standard" implementation of MQTT runs over TCP/IP. So in the majority of cases, the MQTT client is an IP device and has an IP address (though of course with the common NAT scenarios, the IP seen by the broker may not be the device's local IP address, and it's certainly not a good way to authenticate a device, just to maintain a TCP connection established). What do you mean by "identify"? Commented Apr 28 at 13:32
  • 1
    MQTT clients are not assigned any IP addresses unlike web clients ... you may be misunderstanding something Commented Apr 28 at 15:10
  • I understood that in MQTT it is only the clients initiate communicates with the broker using the IP address of the broker but broker differentiates between the clients based on client ID rather than IP address of the clients. This made me to wonder on how broker sends data to MQTT clients based on client ID rather than the IP address. Commented Apr 29 at 8:22

2 Answers 2

0

Can the question be phrased:

How does the MQTT server talk to the MQTT client with out prior knowledge of the IP address of MQTT client?

The MQTT client sends the MQTT broker a CONNECT messsage. The connection must be left open so that the MQTT server can push messages to the MQTT client.

1
  • 1
    Sure. I'll change it. There is a disconnect command. But I'm not sure under what conditions a client would disconnect. Maybe if the client were to power down. Commented May 1 at 1:55
1

MQTT clients are identified by the client id that is contained in the connect packet, they can also optionally provided a username and password (or a client certificate) to assert they own the identity.

All of this runs over a single persistent TCP/IP connection (normally) so once connected the broker always a open connection to any given client

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.