---
tag: api
type: function
name: connect
params:
- name: clientID
description: the client ID to use when connecting to the server
type: const char[]
- name: Credentials
optionalGroup: true
params:
- name: username
description: the username to use. If NULL
, no username or password is used
type: const char[]
- name: password
description: the password to use. If NULL
, no password is used
type: const char[]
- name: Will
optionalGroup: true
params:
- name: willTopic
description: the topic to be used by the will message
type: const char[]
- name: willQoS
description: the quality of service to be used by the will message
type: 'int: 0,1 or 2'
- name: willRetain
description: whether the will should be published with the retain flag
type: boolean
- name: willMessage
description: the payload of the will message
type: const char[]
- name: cleanSession
description: whether to connect clean-session or not
type: boolean
optional: true
returns:
type: boolean
values:
- value: 'false'
description: connection failed
- value: 'true'
description: connection succeeded
---
Connects the client.