connect
Connect to the MQTT broker at the specified endpoint.
Performs the CONNECT/CONNACK handshake. On success, starts forwarding incoming messages to messages and connection state changes to connectionState.
If the broker responds with a server redirect (reason code USE_ANOTHER_SERVER or SERVER_MOVED with a Server Reference property), the client automatically follows the redirect up to MAX_REDIRECTS times (§4.13).
Parameters
endpoint
Broker endpoint (TCP or WebSocket).
Throws
if the broker rejects the connection.