X-Ryl669 / eMQTT5

An embedded MQTTv5 client in C++ with minimal footprint, maximal performance
MIT License
65 stars 14 forks source link

How to connect without ClientID? #22

Closed 1115william closed 3 months ago

1115william commented 4 months ago

It needs a clientID to initialize the Network::Client::MQTTv5, but if we don't have clientID, how to connect to the server? for example, connect to a remote broker.

X-Ryl669 commented 4 months ago

That's not a problem. You can pass a NULL (nullptr or 0) value for the clientID in the constructor and it'll just use what the broker provides.

The documentation in the MQTTClient.hpp states:

@param clientID     A client identifier if you need to provide one. If empty or null, the broker will assign one

I'm not building the doxygen documentation by default when you build the library, so you might miss it.

In that case, I invite you to visit the documentation size for a better description of parameters and what is supported.