Can't find error in syntax

I am trying to use PubSubClient library for MQTT connection with Arduino. I am using the code below to create the connection with credentials and cleanSession set to false for the persistent session.
This is the line of code I am using which is defined under the setup loop:

client.connect("XYZ759", ["username", '"0123456789"], [false]);

I am getting the following error:

expected '{' before ',' token.

The void loop brakets are checked and all other brackets are checked but I can't find where the problem is.
I tried setting the client ID and creditionals in a constant character array in global variables but still got the same error.

This is the link for the syntax of the connect function:
https://pubsubclient.knolleary.net/api#connect

{ != [
And
} != ]

This is just a snippet of my full answer (hint)

In the example you link to

boolean connect (clientID, [username, password], [willTopic, willQoS, willRetain, willMessage], [cleanSession])

the square brackets indicate that the parameters are optional. The square brackets themselves should not be in your code, nor should the spurious ' before the password

Thank you, but I don't think I need to use ! in my code.

What code would that be? (Hint)

Batool_Khader:
Thank you, but I don't think I need to use ! in my code.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.