AWS IoT Device SDK C++ v2  1.32.6
AWS IoT Device SDK C++ v2
Public Member Functions | List of all members
Aws::Crt::Mqtt::MqttClient Class Referencefinal

#include <MqttClient.h>

Public Member Functions

 MqttClient (Io::ClientBootstrap &bootstrap, Allocator *allocator=ApiAllocator()) noexcept
 
 MqttClient (Allocator *allocator=ApiAllocator()) noexcept
 
 ~MqttClient ()
 
 MqttClient (const MqttClient &)=delete
 
 MqttClient (MqttClient &&) noexcept
 
MqttClientoperator= (const MqttClient &)=delete
 
MqttClientoperator= (MqttClient &&) noexcept
 
 operator bool () const noexcept
 
int LastError () const noexcept
 
std::shared_ptr< MqttConnectionNewConnection (const char *hostName, uint32_t port, const Io::SocketOptions &socketOptions, const Crt::Io::TlsContext &tlsContext, bool useWebsocket=false) noexcept
 
std::shared_ptr< MqttConnectionNewConnection (const char *hostName, uint32_t port, const Io::SocketOptions &socketOptions, bool useWebsocket=false) noexcept
 

Detailed Description

An MQTT client. This is a move-only type. Unless otherwise specified, all function arguments need only to live through the duration of the function call.

Constructor & Destructor Documentation

◆ MqttClient() [1/4]

Aws::Crt::Mqtt::MqttClient::MqttClient ( Io::ClientBootstrap bootstrap,
Allocator allocator = ApiAllocator() 
)
noexcept

Initialize an MqttClient using bootstrap and allocator

◆ MqttClient() [2/4]

Aws::Crt::Mqtt::MqttClient::MqttClient ( Allocator allocator = ApiAllocator())
noexcept

Initialize an MqttClient using a allocator and the default ClientBootstrap

For more information on the default ClientBootstrap see Aws::Crt::ApiHandle::GetOrCreateStaticDefaultClientBootstrap

◆ ~MqttClient()

Aws::Crt::Mqtt::MqttClient::~MqttClient ( )

◆ MqttClient() [3/4]

Aws::Crt::Mqtt::MqttClient::MqttClient ( const MqttClient )
delete

◆ MqttClient() [4/4]

Aws::Crt::Mqtt::MqttClient::MqttClient ( MqttClient &&  toMove)
noexcept

Member Function Documentation

◆ LastError()

int Aws::Crt::Mqtt::MqttClient::LastError ( ) const
noexcept
Returns
the value of the last aws error encountered by operations on this instance.

◆ NewConnection() [1/2]

std::shared_ptr< MqttConnection > Aws::Crt::Mqtt::MqttClient::NewConnection ( const char *  hostName,
uint32_t  port,
const Io::SocketOptions socketOptions,
bool  useWebsocket = false 
)
noexcept

Create a new connection object over plain text from the client. The client must outlive all of its connection instances.

Parameters
hostNameendpoint to connect to
portport to connect to
socketOptionssocket options to use when establishing the connection
useWebsocketshould the connection use websockets or should it use direct mqtt?
Returns
a new connection object. Connect() will still need to be called after all further configuration is finished.

◆ NewConnection() [2/2]

std::shared_ptr< MqttConnection > Aws::Crt::Mqtt::MqttClient::NewConnection ( const char *  hostName,
uint32_t  port,
const Io::SocketOptions socketOptions,
const Crt::Io::TlsContext tlsContext,
bool  useWebsocket = false 
)
noexcept

Create a new connection object using TLS from the client. The client must outlive all of its connection instances.

Parameters
hostNameendpoint to connect to
portport to connect to
socketOptionssocket options to use when establishing the connection
tlsContexttls context to use with the connection
useWebsocketshould the connection use websockets or should it use direct mqtt?
Returns
a new connection object. Connect() will still need to be called after all further configuration is finished.

◆ operator bool()

Aws::Crt::Mqtt::MqttClient::operator bool ( ) const
noexcept
Returns
true if the instance is in a valid state, false otherwise.

◆ operator=() [1/2]

MqttClient& Aws::Crt::Mqtt::MqttClient::operator= ( const MqttClient )
delete

◆ operator=() [2/2]

MqttClient & Aws::Crt::Mqtt::MqttClient::operator= ( MqttClient &&  toMove)
noexcept

The documentation for this class was generated from the following files: