AWS IoT Device SDK C++ v2 1.44.1
AWS IoT Device SDK C++ v2
Loading...
Searching...
No Matches
Aws::Crt::Mqtt Namespace Reference

Classes

class  MqttClient
class  MqttConnection
struct  MqttConnectionOperationStatistics
struct  MqttConnectionOptions
struct  OnConnectionClosedData
struct  OnConnectionFailureData
struct  OnConnectionSuccessData

Typedefs

using OnConnectionInterruptedHandler = std::function<void(MqttConnection &connection, int error)>
using OnConnectionResumedHandler
using OnConnectionCompletedHandler
using OnConnectionClosedHandler
using OnConnectionSuccessHandler
using OnConnectionFailureHandler
using OnDisconnectHandler = std::function<void(MqttConnection &connection)>
using OnPublishReceivedHandler
using OnWebSocketHandshakeInterceptComplete
using OnWebSocketHandshakeIntercept
using OnMessageReceivedHandler
using OnSubAckHandler
using OnMultiSubAckHandler
using OnOperationCompleteHandler
using QOS = aws_mqtt_qos
using ReturnCode = aws_mqtt_connect_return_code

Typedef Documentation

◆ OnConnectionClosedHandler

Initial value:
std::function<void(MqttConnection &connection, OnConnectionClosedData *callbackData)>
Definition MqttConnection.h:158
Definition MqttConnection.h:47

Invoked when a connection is disconnected and shutdown successfully.

Note: Currently callbackData will always be nullptr, but this may change in the future to send additional data.

◆ OnConnectionCompletedHandler

Initial value:
std::function<
void(MqttConnection &connection, int errorCode, ReturnCode returnCode, bool sessionPresent)>
aws_mqtt_connect_return_code ReturnCode
Definition Types.h:41

Invoked when a connack message is received, or an error occurred.

◆ OnConnectionFailureHandler

Initial value:
std::function<void(MqttConnection &connection, OnConnectionFailureData *callbackData)>
Definition MqttConnection.h:71

Invoked whenever the connection fails to connect.

This callback is invoked for every failed connect and every failed reconnect.

◆ OnConnectionInterruptedHandler

using Aws::Crt::Mqtt::OnConnectionInterruptedHandler = std::function<void(MqttConnection &connection, int error)>

Invoked Upon Connection loss.

◆ OnConnectionResumedHandler

Initial value:
std::function<void(MqttConnection &connection, ReturnCode connectCode, bool sessionPresent)>

Invoked Upon Connection resumed.

◆ OnConnectionSuccessHandler

Initial value:
std::function<void(MqttConnection &connection, OnConnectionSuccessData *callbackData)>
Definition MqttConnection.h:54

Invoked whenever the connection successfully connects.

This callback is invoked for every successful connect and every successful reconnect.

◆ OnDisconnectHandler

using Aws::Crt::Mqtt::OnDisconnectHandler = std::function<void(MqttConnection &connection)>

Invoked when a disconnect message has been sent.

◆ OnMessageReceivedHandler

Initial value:
std::function<void(
MqttConnection &connection,
const String &topic,
const ByteBuf &payload,
bool dup,
QOS qos,
bool retain)>
aws_mqtt_qos QOS
Definition Types.h:40
std::basic_string< char, std::char_traits< char >, StlAllocator< char > > String
Definition Types.h:45
aws_byte_buf ByteBuf
Definition Types.h:30

Invoked upon receipt of a Publish message on a subscribed topic.

Parameters
connectionThe connection object.
topicThe information channel to which the payload data was published.
payloadThe payload data.
dupDUP flag. If true, this might be re-delivery of an earlier attempt to send the message.
qosQuality of Service used to deliver the message.
retainRetain flag. If true, the message was sent as a result of a new subscription being made by the client.

◆ OnMultiSubAckHandler

Initial value:
std::function<void(
MqttConnection &connection,
uint16_t packetId,
const Vector<String> &topics,
QOS qos,
int errorCode)>
std::vector< T, StlAllocator< T > > Vector
Definition Types.h:53

Invoked when a suback message for multiple topics is received.

Parameters
connectionThe connection object.
packetIdPacket ID of the corresponding subscribe request.
topicsThe information channels to which the payload data was published.
qosQuality of Service used to deliver the message.
errorCodeIndicating if an error occurred.

◆ OnOperationCompleteHandler

Initial value:
std::function<void(MqttConnection &connection, uint16_t packetId, int errorCode)>

Invoked when an operation completes.

For QoS 0, this is when the packet is passed to the tls layer. For QoS 1 (and 2, in theory) this is when the final ACK packet is received from the server.

Parameters
connectionThe connection object.
packetIdPacket ID of the corresponding subscribe request.
errorCodeIndicating if an error occurred.

◆ OnPublishReceivedHandler

Initial value:
std::function<void(MqttConnection &connection, const String &topic, const ByteBuf &payload)>
Deprecated
Use OnMessageReceivedHandler

◆ OnSubAckHandler

Initial value:
std::function<
void(MqttConnection &connection, uint16_t packetId, const String &topic, QOS qos, int errorCode)>

Invoked when a suback message is received.

Parameters
connectionThe connection object.
packetIdPacket ID of the corresponding subscribe request.
topicThe information channel to which the payload data was published.
qosQuality of Service used to deliver the message.
errorCodeIndicating if an error occurred.

◆ OnWebSocketHandshakeIntercept

Initial value:
std::function<
void(std::shared_ptr<Http::HttpRequest> req, const OnWebSocketHandshakeInterceptComplete &onComplete)>
std::function< void(const std::shared_ptr< Http::HttpRequest > &, int errorCode)> OnWebSocketHandshakeInterceptComplete
Definition MqttConnection.h:136

Invoked during websocket handshake to give users opportunity to transform an http request for purposes such as signing/authorization etc... Returning from this function does not continue the websocket handshake since some work flows may be asynchronous. To accommodate that, onComplete must be invoked upon completion of the signing process.

◆ OnWebSocketHandshakeInterceptComplete

Initial value:
std::function<void(const std::shared_ptr<Http::HttpRequest> &, int errorCode)>

Callback for users to invoke upon completion of, presumably asynchronous, OnWebSocketHandshakeIntercept callback's initiated process.

◆ QOS

using Aws::Crt::Mqtt::QOS = aws_mqtt_qos

◆ ReturnCode

using Aws::Crt::Mqtt::ReturnCode = aws_mqtt_connect_return_code