23 #include <aws/mqtt/client.h>
35 class ClientBootstrap;
93 std::function<void(
MqttConnection &connection, uint16_t packetId,
int errorCode)>;
100 std::function<void(
const std::shared_ptr<Http::HttpRequest> &,
int errorCode)>;
130 operator bool() const noexcept;
139 bool SetWill(const
char *topic,
QOS qos,
bool retain, const
ByteBuf &payload) noexcept;
145 bool SetLogin(const
char *userName, const
char *password) noexcept;
150 bool SetWebsocketProxyOptions(const Http::HttpClientConnectionProxyOptions &proxyOptions) noexcept;
157 const
char *clientId,
159 uint16_t keepAliveTimeSecs = 0,
160 uint32_t pingTimeoutMs = 0) noexcept;
165 bool Disconnect() noexcept;
173 const
char *topicFilter,
218 aws_mqtt_client *m_owningClient;
219 aws_mqtt_client_connection *m_underlyingConnection;
222 Crt::Io::TlsContext m_tlsContext;
223 Io::TlsConnectionOptions m_tlsOptions;
224 Io::SocketOptions m_socketOptions;
225 Crt::
Optional<Http::HttpClientConnectionProxyOptions> m_proxyOptions;
231 aws_mqtt_client *client,
232 const
char *hostName,
234 const Io::SocketOptions &socketOptions,
235 const Crt::Io::TlsContext &tlsContext,
236 bool useWebsocket) noexcept;
239 aws_mqtt_client *client,
240 const
char *hostName,
242 const Io::SocketOptions &socketOptions,
243 bool useWebsocket) noexcept;
245 static
void s_onConnectionInterrupted(aws_mqtt_client_connection *,
int errorCode,
void *userData);
246 static
void s_onConnectionCompleted(
247 aws_mqtt_client_connection *,
249 enum aws_mqtt_connect_return_code returnCode,
252 static
void s_onConnectionResumed(
253 aws_mqtt_client_connection *,
258 static
void s_onDisconnect(aws_mqtt_client_connection *connection,
void *userData);
259 static
void s_onPublish(
260 aws_mqtt_client_connection *connection,
261 const aws_byte_cursor *topic,
262 const aws_byte_cursor *payload,
265 static
void s_onSubAck(
266 aws_mqtt_client_connection *connection,
268 const struct aws_byte_cursor *topic,
269 enum aws_mqtt_qos qos,
272 static
void s_onMultiSubAck(
273 aws_mqtt_client_connection *connection,
275 const struct aws_array_list *topic_subacks,
278 static
void s_onOpComplete(
279 aws_mqtt_client_connection *connection,
284 static
void s_onWebsocketHandshake(
285 struct aws_http_message *request,
287 aws_mqtt_transform_websocket_handshake_complete_fn *complete_fn,
290 static
void s_connectionInit(
292 const
char *hostName,
294 const Io::SocketOptions &socketOptions);
318 operator
bool() const noexcept;
329 const
char *hostName,
331 const Io::SocketOptions &socketOptions,
332 const Crt::Io::TlsContext &tlsContext,
333 bool useWebsocket = false) noexcept;
339 const
char *hostName,
341 const Io::SocketOptions &socketOptions,
342 bool useWebsocket = false) noexcept;
345 aws_mqtt_client *m_client;