mqtt_cpp
Classes | Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes > Class Template Referenceabstract

#include <endpoint.hpp>

Inheritance diagram for MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes >:
Inheritance graph
[legend]
Collaboration diagram for MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes >:
Collaboration graph
[legend]

Public Types

using async_handler_t = std::function< void(error_code ec)>
 
using packet_id_t = typename packet_id_type< PacketIdBytes >::type
 

Public Member Functions

 endpoint (as::io_context &ioc, protocol_version version=protocol_version::undetermined, bool async_send_store=false)
 Constructor for client. More...
 
 endpoint (as::io_context &ioc, std::shared_ptr< MQTT_NS::socket > socket, protocol_version version=protocol_version::undetermined, bool async_send_store=false)
 Constructor for server. socket should have already been connected with another endpoint. More...
 
 endpoint (this_type const &)=delete
 
 endpoint (this_type &&)=delete
 
endpointoperator= (this_type const &)=delete
 
endpointoperator= (this_type &&)=delete
 
bool clean_session () const
 Get clean session. More...
 
bool clean_start () const
 Get clean start. More...
 
std::size_t get_total_bytes_received () const
 get_total_bytes_received More...
 
std::size_t get_total_bytes_sent () const
 get_total_bytes_sent More...
 
void set_auto_pub_response (bool b=true, bool async=true)
 Set auto publish response mode. More...
 
void set_auto_map_topic_alias_send (bool b=true)
 Set topic alias send auto mapping enable flag. More...
 
void set_auto_replace_topic_alias_send (bool b=true)
 Set topic alias send auto replacing enable flag. More...
 
void set_packet_bulk_read_limit (std::size_t size)
 
void set_props_bulk_read_limit (std::size_t size)
 
void set_topic_alias_maximum (topic_alias_t max)
 set topic alias maximum for receiving More...
 
void start_session (any session_life_keeper=any())
 start session with a connected endpoint. More...
 
template<typename T , typename... Params>
std::enable_if_t< ! std::is_convertible< std::decay_t< T >, packet_id_t >::value, packet_id_tpublish (T &&t, Params &&... params)
 Publish. More...
 
template<typename T , typename... Params>
std::enable_if_t< ! std::is_convertible< std::decay_t< T >, packet_id_t >::value, packet_id_tsubscribe (T &&t, Params &&... params)
 Subscribe. More...
 
template<typename T , typename... Params>
std::enable_if_t< ! std::is_convertible< std::decay_t< T >, packet_id_t >::value, packet_id_tunsubscribe (T &&t, Params &&... params)
 Unsubscribe. More...
 
void disconnect (v5::disconnect_reason_code reason=v5::disconnect_reason_code::normal_disconnection, v5::properties props={})
 Disconnect Send a disconnect packet to the connected broker. It is a clean disconnecting sequence. The broker disconnects the endpoint after receives the disconnect packet.
When the endpoint disconnects using disconnect(), a will won't send.
See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901205
More...
 
void force_disconnect ()
 Disconnect by endpoint Force disconnect. It is not a clean disconnect sequence.
When the endpoint disconnects using force_disconnect(), a will will send.
More...
 
void publish (packet_id_t packet_id, std::string topic_name, std::string contents, publish_options pubopts={}, v5::properties props={}, any life_keeper={})
 Publish with already acquired packet identifier. More...
 
template<typename ConstBufferSequence >
std::enable_if< as::is_const_buffer_sequence< ConstBufferSequence >::value >::type publish (packet_id_t packet_id, as::const_buffer topic_name, ConstBufferSequence contents, publish_options pubopts, v5::properties props, any life_keeper)
 Publish with already acquired packet identifier. More...
 
template<typename ConstBufferSequence >
std::enable_if< as::is_const_buffer_sequence< ConstBufferSequence >::value >::type publish (packet_id_t packet_id, as::const_buffer topic_name, ConstBufferSequence contents, publish_options pubopts, any life_keeper)
 Publish with already acquired packet identifier. More...
 
template<typename BufferSequence >
std::enable_if< is_buffer_sequence< BufferSequence >::value >::type publish (packet_id_t packet_id, buffer topic_name, BufferSequence contents, publish_options pubopts={}, any life_keeper={})
 Publish with already acquired packet identifier. More...
 
template<typename BufferSequence >
std::enable_if< is_buffer_sequence< BufferSequence >::value >::type publish (packet_id_t packet_id, buffer topic_name, BufferSequence contents, publish_options pubopts, v5::properties props, any life_keeper={})
 Publish with already acquired packet identifier. More...
 
void subscribe (packet_id_t packet_id, string_view topic_filter, subscribe_options option, v5::properties props={})
 Subscribe with already acquired packet identifier. More...
 
void subscribe (packet_id_t packet_id, as::const_buffer topic_filter, subscribe_options option, v5::properties props={})
 Subscribe with already acquired packet identifier. More...
 
void subscribe (packet_id_t packet_id, std::vector< std::tuple< string_view, subscribe_options >> params, v5::properties props={})
 Subscribe with already acquired packet identifier. More...
 
void subscribe (packet_id_t packet_id, std::vector< std::tuple< buffer, subscribe_options >> params, v5::properties props={})
 Subscribe with already acquired packet identifier. More...
 
void unsubscribe (packet_id_t packet_id, string_view topic_filter, v5::properties props={})
 Unsubscribe with already acquired packet identifier. More...
 
void unsubscribe (packet_id_t packet_id, as::const_buffer topic_filter, v5::properties props={})
 Unsubscribe with already acquired packet identifier. More...
 
void unsubscribe (packet_id_t packet_id, std::vector< string_view > params, v5::properties props={})
 Unsubscribe with already acquired packet identifier. More...
 
void unsubscribe (packet_id_t packet_id, std::vector< as::const_buffer > params, v5::properties props={})
 Unsubscribe with already acquired packet identifier. More...
 
void unsubscribe (packet_id_t packet_id, std::vector< buffer > params, v5::properties props={})
 Unsubscribe with already acquired packet identifier. More...
 
void pingreq ()
 Send pingreq packet. See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901195. More...
 
void pingresp ()
 Send pingresp packet. This function is for broker. See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901200. More...
 
void auth (v5::auth_reason_code reason_code=v5::auth_reason_code::success, v5::properties props={})
 Send auth packet. See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc398718086. More...
 
void connect (std::string const &client_id, optional< std::string > const &user_name, optional< std::string > const &password, optional< will > w, std::uint16_t keep_alive_sec, v5::properties props={})
 Send connect packet. More...
 
void connect (buffer client_id, optional< buffer > user_name, optional< buffer > password, optional< will > w, std::uint16_t keep_alive_sec, v5::properties props={})
 Send connect packet. More...
 
void connack (bool session_present, variant< connect_return_code, v5::connect_reason_code > reason_code, v5::properties props={})
 Send connack packet. This function is for broker. More...
 
void puback (packet_id_t packet_id, v5::puback_reason_code reason_code=v5::puback_reason_code::success, v5::properties props={})
 Send puback packet. More...
 
void pubrec (packet_id_t packet_id, v5::pubrec_reason_code reason_code=v5::pubrec_reason_code::success, v5::properties props={})
 Send packet. More...
 
void pubrel (packet_id_t packet_id, v5::pubrel_reason_code reason_code=v5::pubrel_reason_code::success, v5::properties props={}, any life_keeper={})
 Send pubrel packet. More...
 
void pubcomp (packet_id_t packet_id, v5::pubcomp_reason_code reason_code=v5::pubcomp_reason_code::success, v5::properties props={})
 Send pubcomp packet. More...
 
void suback (packet_id_t packet_id, variant< suback_return_code, v5::suback_reason_code > reason, v5::properties props={})
 Send suback packet. This function is for broker. More...
 
void suback (packet_id_t packet_id, variant< std::vector< suback_return_code >, std::vector< v5::suback_reason_code >> reasons, v5::properties props={})
 Send suback packet. This function is for broker. More...
 
void unsuback (packet_id_t packet_id)
 Send unsuback packet. This function is for broker. More...
 
void unsuback (packet_id_t packet_id, v5::unsuback_reason_code reason, v5::properties props={})
 Send unsuback packet. This function is for broker. More...
 
void unsuback (packet_id_t packet_id, std::vector< v5::unsuback_reason_code > reasons, v5::properties props={})
 Send unsuback packet. This function is for broker. More...
 
template<typename T , typename... Params>
std::enable_if_t< ! std::is_convertible< std::decay_t< T >, packet_id_t >::value > async_publish (T &&t, Params &&... params)
 Publish. More...
 
void async_disconnect (async_handler_t func={})
 Disconnect. More...
 
void async_disconnect (v5::disconnect_reason_code reason, v5::properties props, async_handler_t func={})
 Disconnect. More...
 
template<typename T , typename... Params>
std::enable_if_t< ! std::is_convertible< std::decay_t< T >, packet_id_t >::value > async_subscribe (T &&t, Params &&... params)
 Subscribe. More...
 
template<typename T , typename... Params>
std::enable_if_t< ! std::is_convertible< std::decay_t< T >, packet_id_t >::value > async_unsubscribe (T &&t, Params &&... params)
 Unsubscribe. More...
 
void async_publish (packet_id_t packet_id, std::string topic_name, std::string contents, publish_options pubopts={}, async_handler_t func={})
 Publish with a manual set packet identifier. More...
 
void async_publish (packet_id_t packet_id, std::string topic_name, std::string contents, publish_options pubopts, v5::properties props, any life_keeper={}, async_handler_t func={})
 Publish with a manual set packet identifier. More...
 
template<typename ConstBufferSequence >
std::enable_if< as::is_const_buffer_sequence< ConstBufferSequence >::value >::type async_publish (packet_id_t packet_id, as::const_buffer topic_name, ConstBufferSequence contents, publish_options pubopts={}, any life_keeper={}, async_handler_t func={})
 Publish with a manual set packet identifier. More...
 
template<typename ConstBufferSequence >
std::enable_if< as::is_const_buffer_sequence< ConstBufferSequence >::value >::type async_publish (packet_id_t packet_id, as::const_buffer topic_name, ConstBufferSequence contents, publish_options pubopts, v5::properties props, any life_keeper={}, async_handler_t func={})
 Publish with a manual set packet identifier. More...
 
template<typename BufferSequence >
std::enable_if< is_buffer_sequence< BufferSequence >::value >::type async_publish (packet_id_t packet_id, buffer topic_name, BufferSequence contents, publish_options pubopts={}, any life_keeper={}, async_handler_t func={})
 Publish with a manual set packet identifier. More...
 
template<typename BufferSequence >
std::enable_if< is_buffer_sequence< BufferSequence >::value >::type async_publish (packet_id_t packet_id, buffer topic_name, BufferSequence contents, publish_options pubopts, v5::properties props, any life_keeper={}, async_handler_t func={})
 Publish with a manual set packet identifier. More...
 
void async_subscribe (packet_id_t packet_id, std::string topic_filter, subscribe_options option, async_handler_t func={})
 Subscribe. More...
 
void async_subscribe (packet_id_t packet_id, std::string topic_filter, subscribe_options option, v5::properties props, async_handler_t func={})
 Subscribe. More...
 
void async_subscribe (packet_id_t packet_id, as::const_buffer topic_filter, subscribe_options option, async_handler_t func)
 Subscribe. More...
 
void async_subscribe (packet_id_t packet_id, as::const_buffer topic_filter, subscribe_options option, v5::properties props, async_handler_t func)
 Subscribe. More...
 
void async_subscribe (packet_id_t packet_id, buffer topic_filter, subscribe_options option, async_handler_t func={})
 Subscribe. More...
 
void async_subscribe (packet_id_t packet_id, buffer topic_filter, subscribe_options option, v5::properties props, async_handler_t func={})
 Subscribe. More...
 
void async_subscribe (packet_id_t packet_id, std::vector< std::tuple< std::string, subscribe_options >> params, async_handler_t func={})
 Subscribe. More...
 
void async_subscribe (packet_id_t packet_id, std::vector< std::tuple< std::string, subscribe_options >> params, v5::properties props, async_handler_t func={})
 Subscribe. More...
 
void async_subscribe (packet_id_t packet_id, std::vector< std::tuple< as::const_buffer, subscribe_options >> params, async_handler_t func)
 Subscribe. More...
 
void async_subscribe (packet_id_t packet_id, std::vector< std::tuple< as::const_buffer, subscribe_options >> params, v5::properties props, async_handler_t func)
 Subscribe. More...
 
void async_subscribe (packet_id_t packet_id, std::vector< std::tuple< buffer, subscribe_options >> params, async_handler_t func={})
 Subscribe. More...
 
void async_subscribe (packet_id_t packet_id, std::vector< std::tuple< buffer, subscribe_options >> params, v5::properties props, async_handler_t func={})
 Subscribe. More...
 
void async_unsubscribe (packet_id_t packet_id, std::string topic_filter, async_handler_t func={})
 Unsubscribe. More...
 
void async_unsubscribe (packet_id_t packet_id, as::const_buffer topic_filter, async_handler_t func)
 Unsubscribe. More...
 
void async_unsubscribe (packet_id_t packet_id, buffer topic_filter, async_handler_t func={})
 Unsubscribe. More...
 
void async_unsubscribe (packet_id_t packet_id, buffer topic_filter, v5::properties props, async_handler_t func={})
 Unsubscribe. More...
 
void async_unsubscribe (packet_id_t packet_id, std::vector< std::string > params, async_handler_t func={})
 Unsubscribe. More...
 
void async_unsubscribe (packet_id_t packet_id, std::vector< std::string > params, v5::properties props, async_handler_t func={})
 Unsubscribe. More...
 
void async_unsubscribe (packet_id_t packet_id, std::vector< as::const_buffer > params, async_handler_t func)
 Unsubscribe. More...
 
void async_unsubscribe (packet_id_t packet_id, std::vector< as::const_buffer > params, v5::properties props, async_handler_t func)
 Unsubscribe. More...
 
void async_unsubscribe (packet_id_t packet_id, std::vector< buffer > params, async_handler_t func={})
 Unsubscribe. More...
 
void async_unsubscribe (packet_id_t packet_id, std::vector< buffer > params, v5::properties props, async_handler_t func={})
 Unsubscribe. More...
 
void async_pingreq (async_handler_t func={})
 Send pingreq packet. More...
 
void async_pingresp (async_handler_t func={})
 Send pingresp packet. This function is for broker. More...
 
void async_auth (v5::auth_reason_code reason_code=v5::auth_reason_code::success, v5::properties props={}, async_handler_t func={})
 Send auth packet. More...
 
void async_connect (buffer client_id, optional< buffer > user_name, optional< buffer > password, optional< will > w, std::uint16_t keep_alive_sec, async_handler_t func={})
 Send connect packet. More...
 
void async_connect (buffer client_id, optional< buffer > user_name, optional< buffer > password, optional< will > w, std::uint16_t keep_alive_sec, v5::properties props, async_handler_t func={})
 Send connect packet. More...
 
void async_connack (bool session_present, variant< connect_return_code, v5::connect_reason_code > reason_code, async_handler_t func={})
 Send connack packet. This function is for broker. More...
 
void async_connack (bool session_present, variant< connect_return_code, v5::connect_reason_code > reason_code, v5::properties props, async_handler_t func={})
 Send connack packet. This function is for broker. More...
 
void async_puback (packet_id_t packet_id, async_handler_t func={})
 Send puback packet. More...
 
void async_puback (packet_id_t packet_id, v5::puback_reason_code reason_code, v5::properties props, async_handler_t func={})
 Send puback packet. More...
 
void async_pubrec (packet_id_t packet_id, async_handler_t func={})
 Send pubrec packet. More...
 
void async_pubrec (packet_id_t packet_id, v5::pubrec_reason_code reason_code, v5::properties props, async_handler_t func={})
 Send pubrec packet. More...
 
void async_pubrel (packet_id_t packet_id, async_handler_t func={})
 Send pubrel packet. More...
 
void async_pubrel (packet_id_t packet_id, v5::pubrel_reason_code reason_code, v5::properties props={}, any life_keeper={}, async_handler_t func={})
 Send pubrel packet. More...
 
void async_pubcomp (packet_id_t packet_id, async_handler_t func={})
 Send pubcomp packet. More...
 
void async_pubcomp (packet_id_t packet_id, v5::pubcomp_reason_code reason_code, v5::properties props, async_handler_t func={})
 Send pubcomp packet. More...
 
void async_suback (packet_id_t packet_id, variant< suback_return_code, v5::suback_reason_code > reason, async_handler_t func={})
 Send suback packet. This function is for broker. More...
 
void async_suback (packet_id_t packet_id, variant< suback_return_code, v5::suback_reason_code > reason, v5::properties props, async_handler_t func={})
 Send suback packet. This function is for broker. More...
 
void async_suback (packet_id_t packet_id, variant< std::vector< suback_return_code >, std::vector< v5::suback_reason_code >> reasons, async_handler_t func={})
 Send suback packet. This function is for broker. More...
 
void async_suback (packet_id_t packet_id, variant< std::vector< suback_return_code >, std::vector< v5::suback_reason_code >> reasons, v5::properties props, async_handler_t func={})
 Send suback packet. This function is for broker. More...
 
void async_unsuback (packet_id_t packet_id, v5::unsuback_reason_code reason, async_handler_t func={})
 Send unsuback packet. This function is for broker. More...
 
void async_unsuback (packet_id_t packet_id, v5::unsuback_reason_code reason, v5::properties props, async_handler_t func={})
 Send unsuback packet. This function is for broker. More...
 
void async_unsuback (packet_id_t packet_id, std::vector< v5::unsuback_reason_code > reasons, async_handler_t func={})
 Send unsuback packet. This function is for broker. More...
 
void async_unsuback (packet_id_t packet_id, std::vector< v5::unsuback_reason_code > reasons, v5::properties props, async_handler_t func={})
 Send unsuback packet. This function is for broker. More...
 
void async_unsuback (packet_id_t packet_id, async_handler_t func={})
 Send ununsuback packet. This function is for broker. More...
 
void clear_stored_publish (packet_id_t packet_id)
 Clear stored publish message that has packet_id. More...
 
void for_each_store (std::function< void(char const *, std::size_t)> const &f)
 Apply f to stored messages. More...
 
void for_each_store (std::function< void(basic_store_message_variant< PacketIdBytes >)> const &f)
 Apply f to stored messages. More...
 
void for_each_store_with_life_keeper (std::function< void(basic_store_message_variant< PacketIdBytes >, any)> const &f)
 Apply f to stored messages. More...
 
packet_id_t acquire_unique_packet_id ()
 Acquire the new unique packet id. If all packet ids are already in use, then throw packet_id_exhausted_error exception. After acquiring the packet id, you can call acquired_* functions. The ownership of packet id is moved to the library. Or you can call release_packet_id to release it. More...
 
optional< packet_id_tacquire_unique_packet_id_no_except ()
 Acquire the new unique packet id. If all packet ids are already in use, then returns nullopt After acquiring the packet id, you can call acquired_* functions. The ownership of packet id is moved to the library. Or you can call release_packet_id to release it. More...
 
bool register_packet_id (packet_id_t packet_id)
 Register packet_id to the library. After registering the packet_id, you can call acquired_* functions. The ownership of packet id is moved to the library. Or you can call release_packet_id to release it. More...
 
void release_packet_id (packet_id_t packet_id)
 Release packet_id. More...
 
template<typename Iterator >
std::enable_if_t< std::is_convertible< typename Iterator::value_type, char >::value > restore_serialized_message (Iterator b, Iterator e)
 Restore serialized publish and pubrel messages. This function should be called before connect. More...
 
void restore_serialized_message (basic_publish_message< PacketIdBytes > msg, any life_keeper={})
 Restore serialized publish message. This function should be called before connect. More...
 
void restore_serialized_message (basic_pubrel_message< PacketIdBytes > msg, any life_keeper={})
 Restore serialized pubrel message. This function should be called before connect. More...
 
template<typename Iterator >
std::enable_if_t< std::is_convertible< typename Iterator::value_type, char >::value > restore_v5_serialized_message (Iterator b, Iterator e)
 Restore serialized publish and pubrel messages. This function shouold be called before connect. More...
 
void restore_v5_serialized_message (v5::basic_publish_message< PacketIdBytes > msg, any life_keeper={})
 Restore serialized publish message. This function shouold be called before connect. More...
 
void restore_v5_serialized_message (v5::basic_pubrel_message< PacketIdBytes > msg, any life_keeper={})
 Restore serialized pubrel message. This function shouold be called before connect. More...
 
void restore_serialized_message (basic_store_message_variant< PacketIdBytes > msg, any life_keeper={})
 
void send_store_message (basic_store_message_variant< PacketIdBytes > msg, any life_keeper)
 
void async_send_store_message (basic_store_message_variant< PacketIdBytes > msg, any life_keeper, async_handler_t func)
 
bool connected () const
 Check connection status. More...
 
bool underlying_connected () const
 Check underlying layer connection status. More...
 
void async_read_next_message (any session_life_keeper)
 Trigger next mqtt message manually. If you call this function, you need to set manual receive mode using set_auto_next_read(false);. More...
 
void set_max_queue_send_count (std::size_t count)
 Set maximum number of queued message sending. When async message sending function called during asynchronous processing, the message is enqueued. When current asynchronous message is processed, then concatenate queued messages and send it. This value limits the maximum number of concatenating messages. The default value is 1. More...
 
void set_max_queue_send_size (std::size_t size)
 Set maximum size of queued message sending. When async message sending function called during asynchronous processing, the message is enqueued. When current asynchronous message is processed, then concatenate queued messages and send it. This value limits the maximum size of concatenating messages. The default value is 0. More...
 
protocol_version get_protocol_version () const
 
MQTT_NS::socket const & socket () const
 
MQTT_NS::socketsocket ()
 
auto get_executor ()
 
void set_pingresp_timeout (std::chrono::steady_clock::duration tim)
 Set pingresp timeout. More...
 

Protected Member Functions

virtual void on_close () noexcept=0
 Close handler. More...
 
virtual void on_error (error_code ec) noexcept=0
 Error handler. More...
 
virtual void on_pre_send () noexcept=0
 Pre-send handler This handler is called when any mqtt control packet is decided to send. More...
 
virtual MQTT_ALWAYS_INLINE void on_mqtt_message_processed (any session_life_keeper)
 next read handler This handler is called when the current mqtt message has been processed. More...
 
std::shared_ptr< MQTT_NS::socket > & socket_sp_ref ()
 Get shared_ptr of socket. More...
 
void async_read_control_packet_type (any session_life_keeper)
 
bool handle_close_or_error (error_code ec)
 
void set_connect ()
 
void set_protocol_version (protocol_version version)
 
void clear_session_data ()
 
 ~endpoint ()=default
 

Protected Attributes

bool clean_start_ {false}
 

Friends

struct process_connect
 
struct process_connack
 
struct process_publish
 
struct process_puback
 
struct process_pubrec
 
struct process_pubrel
 
struct process_pubcomp
 
struct process_subscribe
 
struct process_suback
 
struct process_unsubscribe
 
struct process_unsuback
 
struct process_disconnect
 
struct process_auth
 

Member Typedef Documentation

◆ async_handler_t

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
using MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes >::async_handler_t = std::function<void(error_code ec)>

◆ packet_id_t

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
using MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes >::packet_id_t = typename packet_id_type<PacketIdBytes>::type

Constructor & Destructor Documentation

◆ endpoint() [1/4]

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes >::endpoint ( as::io_context &  ioc,
protocol_version  version = protocol_version::undetermined,
bool  async_send_store = false 
)
inline

Constructor for client.

◆ endpoint() [2/4]

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes >::endpoint ( as::io_context &  ioc,
std::shared_ptr< MQTT_NS::socket socket,
protocol_version  version = protocol_version::undetermined,
bool  async_send_store = false 
)
inlineexplicit

Constructor for server. socket should have already been connected with another endpoint.

◆ endpoint() [3/4]

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes >::endpoint ( this_type const &  )
delete

◆ endpoint() [4/4]

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes >::endpoint ( this_type &&  )
delete

◆ ~endpoint()

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes >::~endpoint ( )
protecteddefault

Member Function Documentation

◆ acquire_unique_packet_id()

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
packet_id_t MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes >::acquire_unique_packet_id ( )
inline

Acquire the new unique packet id. If all packet ids are already in use, then throw packet_id_exhausted_error exception. After acquiring the packet id, you can call acquired_* functions. The ownership of packet id is moved to the library. Or you can call release_packet_id to release it.

Returns
packet id

◆ acquire_unique_packet_id_no_except()

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
optional<packet_id_t> MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes >::acquire_unique_packet_id_no_except ( )
inline

Acquire the new unique packet id. If all packet ids are already in use, then returns nullopt After acquiring the packet id, you can call acquired_* functions. The ownership of packet id is moved to the library. Or you can call release_packet_id to release it.

Returns
packet id

◆ async_auth()

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
void MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes >::async_auth ( v5::auth_reason_code  reason_code = v5::auth_reason_code::success,
v5::properties  props = {},
async_handler_t  func = {} 
)
inline

Send auth packet.

Parameters
reason_codeAUTH Reason Code
See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901220
3.15.2.1 Authenticate Reason Code
propsProperties
See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901221
3.15.2.2 AUTH Properties
funcfunctor object who's operator() will be called when the async operation completes. See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc398718086

◆ async_connack() [1/2]

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
void MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes >::async_connack ( bool  session_present,
variant< connect_return_code, v5::connect_reason_code reason_code,
async_handler_t  func = {} 
)
inline

Send connack packet. This function is for broker.

Parameters
session_presentSee https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc385349255
return_codeSee connect_return_code.hpp and https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc385349256
funcfunctor object who's operator() will be called when the async operation completes. See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc398718033

◆ async_connack() [2/2]

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
void MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes >::async_connack ( bool  session_present,
variant< connect_return_code, v5::connect_reason_code reason_code,
v5::properties  props,
async_handler_t  func = {} 
)
inline

Send connack packet. This function is for broker.

Parameters
session_presentSee https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc385349255
return_codeSee connect_return_code.hpp and https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc385349256
propsProperties
See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901080
3.2.2.3 CONNACK Properties
funcfunctor object who's operator() will be called when the async operation completes. See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc398718033

◆ async_connect() [1/2]

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
void MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes >::async_connect ( buffer  client_id,
optional< buffer user_name,
optional< buffer password,
optional< will w,
std::uint16_t  keep_alive_sec,
async_handler_t  func = {} 
)
inline

Send connect packet.

Parameters
client_idThe client id to use for this connection
See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901059
3.1.3.1 Client Identifier (ClientID)
user_nameSee https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901071
3.1.3.5 User Name
passwordSee https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901072
3.1.3.6 Password
wSee https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc479576982
3.1.2.5 Will Flag
keep_alive_secKeep Alive
See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901045
3.1.2.10 Keep Alive
funcfunctor object who's operator() will be called when the async operation completes. See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc398718028

◆ async_connect() [2/2]

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
void MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes >::async_connect ( buffer  client_id,
optional< buffer user_name,
optional< buffer password,
optional< will w,
std::uint16_t  keep_alive_sec,
v5::properties  props,
async_handler_t  func = {} 
)
inline

Send connect packet.

Parameters
client_idThe client id to use for this connection
See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901059
3.1.3.1 Client Identifier (ClientID)
user_nameSee https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901071
3.1.3.5 User Name
passwordSee https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901072
3.1.3.6 Password
wSee https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc479576982
3.1.2.5 Will Flag
keep_alive_secKeep Alive
See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901045
3.1.2.10 Keep Alive
propsProperties
See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901046
3.1.2.11 CONNECT Properties
funcfunctor object who's operator() will be called when the async operation completes. See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc398718028

◆ async_disconnect() [1/2]

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
void MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes >::async_disconnect ( async_handler_t  func = {})
inline

Disconnect.

Parameters
funcfunctor object who's operator() will be called when the async operation completes. Send a disconnect packet to the connected broker. It is a clean disconnecting sequence. The broker disconnects the endpoint after receives the disconnect packet.
When the endpoint disconnects using disconnect(), a will won't send.

◆ async_disconnect() [2/2]

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
void MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes >::async_disconnect ( v5::disconnect_reason_code  reason,
v5::properties  props,
async_handler_t  func = {} 
)
inline

Disconnect.

Parameters
reasonDISCONNECT Reason Code
See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901208
3.14.2.1 Disconnect Reason Code
propsProperties
See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901209
3.14.2.2 DISCONNECT Properties
funcfunctor object who's operator() will be called when the async operation completes. Send a disconnect packet to the connected broker. It is a clean disconnecting sequence. The broker disconnects the endpoint after receives the disconnect packet.
When the endpoint disconnects using disconnect(), a will won't send.

◆ async_pingreq()

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
void MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes >::async_pingreq ( async_handler_t  func = {})
inline

Send pingreq packet.

Parameters
funcfunctor object who's operator() will be called when the async operation completes. See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901195

◆ async_pingresp()

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
void MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes >::async_pingresp ( async_handler_t  func = {})
inline

Send pingresp packet. This function is for broker.

Parameters
funcfunctor object who's operator() will be called when the async operation completes. See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901200

◆ async_puback() [1/2]

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
void MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes >::async_puback ( packet_id_t  packet_id,
async_handler_t  func = {} 
)
inline

Send puback packet.

Parameters
packet_idpacket id corresponding to publish
funcfunctor object who's operator() will be called when the async operation completes. See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc398718043

◆ async_puback() [2/2]

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
void MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes >::async_puback ( packet_id_t  packet_id,
v5::puback_reason_code  reason_code,
v5::properties  props,
async_handler_t  func = {} 
)
inline

Send puback packet.

Parameters
packet_idpacket id corresponding to publish
reason_codePUBACK Reason Code
See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901124
3.4.2.1 PUBACK Reason Code
propsProperties
See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901125
3.4.2.2 PUBACK Properties
funcfunctor object who's operator() will be called when the async operation completes. See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc398718043

◆ async_pubcomp() [1/2]

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
void MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes >::async_pubcomp ( packet_id_t  packet_id,
async_handler_t  func = {} 
)
inline

Send pubcomp packet.

Parameters
packet_idpacket id corresponding to publish
funcfunctor object who's operator() will be called when the async operation completes. See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc398718043

◆ async_pubcomp() [2/2]

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
void MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes >::async_pubcomp ( packet_id_t  packet_id,
v5::pubcomp_reason_code  reason_code,
v5::properties  props,
async_handler_t  func = {} 
)
inline

Send pubcomp packet.

Parameters
packet_idpacket id corresponding to publish
reason_codePUBCOMP Reason Code
See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901154
3.7.2.1 PUBCOMP Reason Code
propsProperties
See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901155
3.7.2.2 PUBCOMP Properties
funcfunctor object who's operator() will be called when the async operation completes. See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc398718043

◆ async_publish() [1/7]

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
template<typename ConstBufferSequence >
std::enable_if< as::is_const_buffer_sequence<ConstBufferSequence>::value >::type MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes >::async_publish ( packet_id_t  packet_id,
as::const_buffer  topic_name,
ConstBufferSequence  contents,
publish_options  pubopts,
v5::properties  props,
any  life_keeper = {},
async_handler_t  func = {} 
)
inline

Publish with a manual set packet identifier.

Parameters
packet_idpacket identifier. It should be acquired by acquire_unique_packet_id, or register_packet_id. The ownership of the packet_id moves to the library. If qos == qos::at_most_once, packet_id must be 0. But not checked in release mode due to performance.
topic_nameA topic name to publish
contentsThe contents or the range of the contents to publish
puboptsqos, retain flag, and dup flag.
propsProperties
See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901109
3.3.2.3 PUBLISH Properties
life_keeperAn object that stays alive as long as the library holds a reference to any other parameters. If topic_name, contents, or props do not have built-in lifetime management, (e.g. buffer) use this parameter to manage their lifetime.
funcfunctor object who's operator() will be called when the async operation completes.

◆ async_publish() [2/7]

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
template<typename ConstBufferSequence >
std::enable_if< as::is_const_buffer_sequence<ConstBufferSequence>::value >::type MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes >::async_publish ( packet_id_t  packet_id,
as::const_buffer  topic_name,
ConstBufferSequence  contents,
publish_options  pubopts = {},
any  life_keeper = {},
async_handler_t  func = {} 
)
inline

Publish with a manual set packet identifier.

Parameters
packet_idpacket identifier. It should be acquired by acquire_unique_packet_id, or register_packet_id. The ownership of the packet_id moves to the library. If qos == qos::at_most_once, packet_id must be 0. But not checked in release mode due to performance.
topic_nameA topic name to publish
contentsThe contents or the range of the contents to publish
puboptsqos, retain flag, and dup flag.
life_keeperAn object that stays alive as long as the library holds a reference to any other parameters. If topic_name, contents, or props do not have built-in lifetime management, (e.g. buffer) use this parameter to manage their lifetime.
funcfunctor object who's operator() will be called when the async operation completes.
Note
If your QOS level is exactly_once or at_least_once, then the library will store this publish internally until the broker has confirmed delivery, which may involve resends, and as such the life_keeper parameter is important.

◆ async_publish() [3/7]

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
template<typename BufferSequence >
std::enable_if< is_buffer_sequence<BufferSequence>::value >::type MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes >::async_publish ( packet_id_t  packet_id,
buffer  topic_name,
BufferSequence  contents,
publish_options  pubopts,
v5::properties  props,
any  life_keeper = {},
async_handler_t  func = {} 
)
inline

Publish with a manual set packet identifier.

Parameters
packet_idpacket identifier. It should be acquired by acquire_unique_packet_id, or register_packet_id. The ownership of the packet_id moves to the library. If qos == qos::at_most_once, packet_id must be 0. But not checked in release mode due to performance.
topic_nameA topic name to publish
contentsThe contents or the range of the contents to publish
puboptsqos, retain flag, and dup flag.
propsProperties
See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901109
3.3.2.3 PUBLISH Properties
life_keeperAn object that stays alive as long as the library holds a reference to any other parameters. If topic_name, contents, or props do not have built-in lifetime management, (e.g. buffer) use this parameter to manage their lifetime.
funcfunctor object who's operator() will be called when the async operation completes.
Note
If your QOS level is exactly_once or at_least_once, then the library will store this publish internally until the broker has confirmed delivery, which may involve resends, and as such the life_keeper parameter is important.

◆ async_publish() [4/7]

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
template<typename BufferSequence >
std::enable_if< is_buffer_sequence<BufferSequence>::value >::type MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes >::async_publish ( packet_id_t  packet_id,
buffer  topic_name,
BufferSequence  contents,
publish_options  pubopts = {},
any  life_keeper = {},
async_handler_t  func = {} 
)
inline

Publish with a manual set packet identifier.

Parameters
packet_idpacket identifier. It should be acquired by acquire_unique_packet_id, or register_packet_id. The ownership of the packet_id moves to the library. If qos == qos::at_most_once, packet_id must be 0. But not checked in release mode due to performance.
topic_nameA topic name to publish
contentsThe contents or the range of the contents to publish
puboptsqos, retain flag, and dup flag.
life_keeperAn object that stays alive as long as the library holds a reference to any other parameters. If topic_name, contents, or props do not have built-in lifetime management, (e.g. buffer) use this parameter to manage their lifetime.
funcfunctor object who's operator() will be called when the async operation completes.

◆ async_publish() [5/7]

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
void MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes >::async_publish ( packet_id_t  packet_id,
std::string  topic_name,
std::string  contents,
publish_options  pubopts,
v5::properties  props,
any  life_keeper = {},
async_handler_t  func = {} 
)
inline

Publish with a manual set packet identifier.

Parameters
packet_idpacket identifier. It should be acquired by acquire_unique_packet_id, or register_packet_id. The ownership of the packet_id moves to the library. If qos == qos::at_most_once, packet_id must be 0. But not checked in release mode due to performance.
topic_nameA topic name to publish
contentsThe contents to publish
puboptsqos, retain flag, and dup flag.
propsProperties
See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901109
3.3.2.3 PUBLISH Properties
life_keeperAn object that stays alive as long as the library holds a reference to any other parameters. If topic_name, contents, or props do not have built-in lifetime management, (e.g. buffer) use this parameter to manage their lifetime.
funcfunctor object who's operator() will be called when the async operation completes.
Note
If your QOS level is exactly_once or at_least_once, then the library will store this publish internally until the broker has confirmed delivery, which may involve resends, and as such the life_keeper parameter is important.

◆ async_publish() [6/7]

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
void MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes >::async_publish ( packet_id_t  packet_id,
std::string  topic_name,
std::string  contents,
publish_options  pubopts = {},
async_handler_t  func = {} 
)
inline

Publish with a manual set packet identifier.

Parameters
packet_idpacket identifier. It should be acquired by acquire_unique_packet_id, or register_packet_id. The ownership of the packet_id moves to the library. If qos == qos::at_most_once, packet_id must be 0. But not checked in release mode due to performance.
topic_nameA topic name to publish
contentsThe contents to publish
puboptsqos, retain flag, and dup flag.
funcfunctor object who's operator() will be called when the async operation completes.

◆ async_publish() [7/7]

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
template<typename T , typename... Params>
std::enable_if_t< ! std::is_convertible<std::decay_t<T>, packet_id_t>::value > MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes >::async_publish ( T &&  t,
Params &&...  params 
)
inline

Publish.

Parameters
topic_nameA topic name to publish
contentsThe contents to publish
puboptsqos, retain flag, and dup flag.
propsProperties
See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901109
3.3.2.3 PUBLISH Properties
life_keeperAn object that stays alive as long as the library holds a reference to any other parameters. If topic_name, contents, or props do not have built-in lifetime management, (e.g. buffer) use this parameter to manage their lifetime.
Returns
packet_id. If qos is set to at_most_once, return 0. packet_id is automatically generated.
Note
If your QOS level is exactly_once or at_least_once, then the library will store this publish internally until the broker has confirmed delivery, which may involve resends, and as such the life_keeper parameter is important.

◆ async_pubrec() [1/2]

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
void MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes >::async_pubrec ( packet_id_t  packet_id,
async_handler_t  func = {} 
)
inline

Send pubrec packet.

Parameters
packet_idpacket id corresponding to publish
funcfunctor object who's operator() will be called when the async operation completes. See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc398718043

◆ async_pubrec() [2/2]

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
void MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes >::async_pubrec ( packet_id_t  packet_id,
v5::pubrec_reason_code  reason_code,
v5::properties  props,
async_handler_t  func = {} 
)
inline

Send pubrec packet.

Parameters
packet_idpacket id corresponding to publish
reason_codePUBREC Reason Code
See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901134
3.5.2.1 PUBREC Reason Code
propsProperties
See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901135
3.5.2.2 PUBREC Properties
funcfunctor object who's operator() will be called when the async operation completes. See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc398718043

◆ async_pubrel() [1/2]

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
void MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes >::async_pubrel ( packet_id_t  packet_id,
async_handler_t  func = {} 
)
inline

Send pubrel packet.

Parameters
packet_idpacket id corresponding to publish
funcfunctor object who's operator() will be called when the async operation completes. See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc398718043

◆ async_pubrel() [2/2]

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
void MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes >::async_pubrel ( packet_id_t  packet_id,
v5::pubrel_reason_code  reason_code,
v5::properties  props = {},
any  life_keeper = {},
async_handler_t  func = {} 
)
inline

Send pubrel packet.

Parameters
packet_idpacket id corresponding to publish
reason_codePUBREL Reason Code
See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901144
3.6.2.1 PUBREL Reason Code
propsProperties
See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901145
3.6.2.2 PUBREL Properties
funcfunctor object who's operator() will be called when the async operation completes. See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc398718043
life_keeperAn object that stays alive as long as the library holds a reference to any other parameters. If topic_name, contents, or props do not have built-in lifetime management, (e.g. buffer) use this parameter to manage their lifetime.
Note
The library may store this message while it communicates with the server for several round trips. As such, the life_keeper paramter is important.

◆ async_read_control_packet_type()

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
void MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes >::async_read_control_packet_type ( any  session_life_keeper)
inlineprotected

◆ async_read_next_message()

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
void MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes >::async_read_next_message ( any  session_life_keeper)
inline

Trigger next mqtt message manually. If you call this function, you need to set manual receive mode using set_auto_next_read(false);.

◆ async_send_store_message()

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
void MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes >::async_send_store_message ( basic_store_message_variant< PacketIdBytes >  msg,
any  life_keeper,
async_handler_t  func 
)
inline

◆ async_suback() [1/4]

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
void MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes >::async_suback ( packet_id_t  packet_id,
variant< std::vector< suback_return_code >, std::vector< v5::suback_reason_code >>  reasons,
async_handler_t  func = {} 
)
inline

Send suback packet. This function is for broker.

Parameters
packet_idpacket id corresponding to subscribe
reasona collection of reason_code
See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901178
3.9.3 SUBACK Payload
funcfunctor object who's operator() will be called when the async operation completes. See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc398718068

◆ async_suback() [2/4]

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
void MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes >::async_suback ( packet_id_t  packet_id,
variant< std::vector< suback_return_code >, std::vector< v5::suback_reason_code >>  reasons,
v5::properties  props,
async_handler_t  func = {} 
)
inline

Send suback packet. This function is for broker.

Parameters
packet_idpacket id corresponding to subscribe
reasona collection of reason_code
See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901178
3.9.3 SUBACK Payload
propsProperties
See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901174
3.9.2.1 SUBACK Properties
funcfunctor object who's operator() will be called when the async operation completes. See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc398718068

◆ async_suback() [3/4]

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
void MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes >::async_suback ( packet_id_t  packet_id,
variant< suback_return_code, v5::suback_reason_code reason,
async_handler_t  func = {} 
)
inline

Send suback packet. This function is for broker.

Parameters
packet_idpacket id corresponding to subscribe
reasonreason_code
See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901178
3.9.3 SUBACK Payload
funcfunctor object who's operator() will be called when the async operation completes. See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc398718068

◆ async_suback() [4/4]

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
void MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes >::async_suback ( packet_id_t  packet_id,
variant< suback_return_code, v5::suback_reason_code reason,
v5::properties  props,
async_handler_t  func = {} 
)
inline

Send suback packet. This function is for broker.

Parameters
packet_idpacket id corresponding to subscribe
reasonreason_code
See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901178
3.9.3 SUBACK Payload
propsProperties
See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901174
3.9.2.1 SUBACK Properties
funcfunctor object who's operator() will be called when the async operation completes. See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc398718068

◆ async_subscribe() [1/13]

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
void MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes >::async_subscribe ( packet_id_t  packet_id,
as::const_buffer  topic_filter,
subscribe_options  option,
async_handler_t  func 
)
inline

Subscribe.

Parameters
packet_idpacket identifier. It should be acquired by acquire_unique_packet_id, or register_packet_id. The ownership of the packet_id moves to the library.
topic_filterA topic filter to subscribe
optionsubscription options
See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901169
3.8.3.1 Subscription Options
funcfunctor object who's operator() will be called when the async operation completes. This object should hold the lifetime of the buffers for topic_filter. You can subscribe multiple topics all at once.
See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901161

◆ async_subscribe() [2/13]

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
void MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes >::async_subscribe ( packet_id_t  packet_id,
as::const_buffer  topic_filter,
subscribe_options  option,
v5::properties  props,
async_handler_t  func 
)
inline

Subscribe.

Parameters
packet_idpacket identifier. It should be acquired by acquire_unique_packet_id, or register_packet_id. The ownership of the packet_id moves to the library.
topic_filterA topic filter to subscribe
optionsubscription options
See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901169
3.8.3.1 Subscription Options
propsProperties
See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901164
3.8.2.1 SUBSCRIBE Properties
funcfunctor object who's operator() will be called when the async operation completes. This object should hold the lifetime of the buffers for topic_filter, and properties. You can subscribe multiple topics all at once.
See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901161

◆ async_subscribe() [3/13]

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
void MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes >::async_subscribe ( packet_id_t  packet_id,
buffer  topic_filter,
subscribe_options  option,
async_handler_t  func = {} 
)
inline

Subscribe.

Parameters
packet_idpacket identifier. It should be acquired by acquire_unique_packet_id, or register_packet_id. The ownership of the packet_id moves to the library.
topic_filterA topic filter to subscribe
optionsubscription options
See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901169
3.8.3.1 Subscription Options
funcfunctor object who's operator() will be called when the async operation completes. You can subscribe multiple topics all at once.
See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901161

◆ async_subscribe() [4/13]

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
void MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes >::async_subscribe ( packet_id_t  packet_id,
buffer  topic_filter,
subscribe_options  option,
v5::properties  props,
async_handler_t  func = {} 
)
inline

Subscribe.

Parameters
packet_idpacket identifier. It should be acquired by acquire_unique_packet_id, or register_packet_id. The ownership of the packet_id moves to the library.
topic_filterA topic filter to subscribe
optionsubscription options
See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901169
3.8.3.1 Subscription Options
propsProperties
See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901164
3.8.2.1 SUBSCRIBE Properties
funcfunctor object who's operator() will be called when the async operation completes. You can subscribe multiple topics all at once.
See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901161

◆ async_subscribe() [5/13]

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
void MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes >::async_subscribe ( packet_id_t  packet_id,
std::string  topic_filter,
subscribe_options  option,
async_handler_t  func = {} 
)
inline

Subscribe.

Parameters
packet_idpacket identifier. It should be acquired by acquire_unique_packet_id, or register_packet_id. The ownership of the packet_id moves to the library.
topic_filterA topic filter to subscribe
optionsubscription options
See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901169
3.8.3.1 Subscription Options
propsProperties
See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901164
3.8.2.1 SUBSCRIBE Properties
funcfunctor object who's operator() will be called when the async operation completes. You can subscribe multiple topics all at once.
See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901161

◆ async_subscribe() [6/13]

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
void MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes >::async_subscribe ( packet_id_t  packet_id,
std::string  topic_filter,
subscribe_options  option,
v5::properties  props,
async_handler_t  func = {} 
)
inline

Subscribe.

Parameters
packet_idpacket identifier. It should be acquired by acquire_unique_packet_id, or register_packet_id. The ownership of the packet_id moves to the library.
topic_filterA topic filter to subscribe
optionsubscription options
See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901169
3.8.3.1 Subscription Options
propsProperties
See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901164
3.8.2.1 SUBSCRIBE Properties
funcfunctor object who's operator() will be called when the async operation completes. You can subscribe multiple topics all at once.
See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901161

◆ async_subscribe() [7/13]

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
void MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes >::async_subscribe ( packet_id_t  packet_id,
std::vector< std::tuple< as::const_buffer, subscribe_options >>  params,
async_handler_t  func 
)
inline

Subscribe.

Parameters
packet_idpacket identifier. It should be acquired by acquire_unique_packet_id, or register_packet_id. The ownership of the packet_id moves to the library.
paramsA collection of the pair of topic_filter and qos to subscribe.
funcfunctor object who's operator() will be called when the async operation completes. This object should hold the lifetime of the buffers for params. You can subscribe multiple topics all at once.
See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901161

◆ async_subscribe() [8/13]

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
void MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes >::async_subscribe ( packet_id_t  packet_id,
std::vector< std::tuple< as::const_buffer, subscribe_options >>  params,
v5::properties  props,
async_handler_t  func 
)
inline

Subscribe.

Parameters
packet_idpacket identifier. It should be acquired by acquire_unique_packet_id, or register_packet_id. The ownership of the packet_id moves to the library.
paramsA collection of the pair of topic_filter and option to subscribe.
See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901169
3.8.3.1 Subscription Options
funcfunctor object who's operator() will be called when the async operation completes. This object should hold the lifetime of the buffers for params. You can subscribe multiple topics all at once.
See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901161

◆ async_subscribe() [9/13]

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
void MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes >::async_subscribe ( packet_id_t  packet_id,
std::vector< std::tuple< buffer, subscribe_options >>  params,
async_handler_t  func = {} 
)
inline

Subscribe.

Parameters
packet_idpacket identifier. It should be acquired by acquire_unique_packet_id, or register_packet_id. The ownership of the packet_id moves to the library.
paramsA collection of the pair of topic_filter and qos to subscribe.
funcfunctor object who's operator() will be called when the async operation completes. You can subscribe multiple topics all at once.
See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901161

◆ async_subscribe() [10/13]

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
void MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes >::async_subscribe ( packet_id_t  packet_id,
std::vector< std::tuple< buffer, subscribe_options >>  params,
v5::properties  props,
async_handler_t  func = {} 
)
inline

Subscribe.

Parameters
packet_idpacket identifier. It should be acquired by acquire_unique_packet_id, or register_packet_id. The ownership of the packet_id moves to the library.
paramsA collection of the pair of topic_filter and option to subscribe.
See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901169
3.8.3.1 Subscription Options
funcfunctor object who's operator() will be called when the async operation completes. You can subscribe multiple topics all at once.
See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901161

◆ async_subscribe() [11/13]

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
void MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes >::async_subscribe ( packet_id_t  packet_id,
std::vector< std::tuple< std::string, subscribe_options >>  params,
async_handler_t  func = {} 
)
inline

Subscribe.

Parameters
packet_idpacket identifier. It should be acquired by acquire_unique_packet_id, or register_packet_id. The ownership of the packet_id moves to the library.
paramsA collection of the pair of topic_filter and option to subscribe.
See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901169
3.8.3.1 Subscription Options
funcfunctor object who's operator() will be called when the async operation completes. You can subscribe multiple topics all at once.
See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901161

◆ async_subscribe() [12/13]

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
void MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes >::async_subscribe ( packet_id_t  packet_id,
std::vector< std::tuple< std::string, subscribe_options >>  params,
v5::properties  props,
async_handler_t  func = {} 
)
inline

Subscribe.

Parameters
packet_idpacket identifier. It should be acquired by acquire_unique_packet_id, or register_packet_id. The ownership of the packet_id moves to the library.
paramsA collection of the pair of topic_filter and option to subscribe.
See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901169
3.8.3.1 Subscription Options
propsProperties
See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901164
3.8.2.1 SUBSCRIBE Properties
funcfunctor object who's operator() will be called when the async operation completes. You can subscribe multiple topics all at once.
See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901161

◆ async_subscribe() [13/13]

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
template<typename T , typename... Params>
std::enable_if_t< ! std::is_convertible<std::decay_t<T>, packet_id_t>::value > MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes >::async_subscribe ( T &&  t,
Params &&...  params 
)
inline

Subscribe.

Parameters
topic_nameA topic name to subscribe
optionsubscription options
See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901169
3.8.3.1 Subscription Options
funcfunctor object who's operator() will be called when the async operation completes. packet_id is automatically generated.
You can subscribe multiple topics all at once.
See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901161

◆ async_unsuback() [1/5]

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
void MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes >::async_unsuback ( packet_id_t  packet_id,
async_handler_t  func = {} 
)
inline

Send ununsuback packet. This function is for broker.

Parameters
packet_idpacket id corresponding to unsubscribe
funcfunctor object who's operator() will be called when the async operation completes. See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc398718077

◆ async_unsuback() [2/5]

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
void MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes >::async_unsuback ( packet_id_t  packet_id,
std::vector< v5::unsuback_reason_code reasons,
async_handler_t  func = {} 
)
inline

Send unsuback packet. This function is for broker.

Parameters
packet_idpacket id corresponding to subscribe
reasonsa collection of reason_code
See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901194
3.11.3 UNSUBACK Payload
funcfunctor object who's operator() will be called when the async operation completes. See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc398718068

◆ async_unsuback() [3/5]

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
void MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes >::async_unsuback ( packet_id_t  packet_id,
std::vector< v5::unsuback_reason_code reasons,
v5::properties  props,
async_handler_t  func = {} 
)
inline

Send unsuback packet. This function is for broker.

Parameters
packet_idpacket id corresponding to subscribe
reasonsa collection of reason_code
See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901194
3.11.3 UNSUBACK Payload
propsProperties
See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901190
3.11.2.1 UNSUBACK Properties
funcfunctor object who's operator() will be called when the async operation completes. See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc398718068

◆ async_unsuback() [4/5]

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
void MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes >::async_unsuback ( packet_id_t  packet_id,
v5::unsuback_reason_code  reason,
async_handler_t  func = {} 
)
inline

Send unsuback packet. This function is for broker.

Parameters
packet_idpacket id corresponding to subscribe
reasonreason_code
See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901194
3.11.3 UNSUBACK Payload
funcfunctor object who's operator() will be called when the async operation completes. See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc398718068

◆ async_unsuback() [5/5]

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
void MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes >::async_unsuback ( packet_id_t  packet_id,
v5::unsuback_reason_code  reason,
v5::properties  props,
async_handler_t  func = {} 
)
inline

Send unsuback packet. This function is for broker.

Parameters
packet_idpacket id corresponding to subscribe
reasonreason_code
See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901194
3.11.3 UNSUBACK Payload
propsProperties
See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901190
3.11.2.1 UNSUBACK Properties
funcfunctor object who's operator() will be called when the async operation completes. See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc398718068

◆ async_unsubscribe() [1/11]

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
void MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes >::async_unsubscribe ( packet_id_t  packet_id,
as::const_buffer  topic_filter,
async_handler_t  func 
)
inline

Unsubscribe.

Parameters
packet_idpacket identifier. It should be acquired by acquire_unique_packet_id, or register_packet_id. The ownership of the packet_id moves to the library.
topic_filtertopic_filter
funcfunctor object who's operator() will be called when the async operation completes. This object should hold the lifetime of the buffer for topic_filter. You can subscribe multiple topics all at once.
See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901161

◆ async_unsubscribe() [2/11]

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
void MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes >::async_unsubscribe ( packet_id_t  packet_id,
buffer  topic_filter,
async_handler_t  func = {} 
)
inline

Unsubscribe.

Parameters
packet_idpacket identifier. It should be acquired by acquire_unique_packet_id, or register_packet_id. The ownership of the packet_id moves to the library.
topic_filtertopic_filter
funcfunctor object who's operator() will be called when the async operation completes. You can subscribe multiple topics all at once.
See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901161

◆ async_unsubscribe() [3/11]

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
void MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes >::async_unsubscribe ( packet_id_t  packet_id,
buffer  topic_filter,
v5::properties  props,
async_handler_t  func = {} 
)
inline

Unsubscribe.

Parameters
packet_idpacket identifier. It should be acquired by acquire_unique_packet_id, or register_packet_id. The ownership of the packet_id moves to the library.
topic_filtertopic_filter
propsProperties
See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901182
3.10.2.1 UNSUBSCRIBE Properties
funcfunctor object who's operator() will be called when the async operation completes. You can subscribe multiple topics all at once.
See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901161

◆ async_unsubscribe() [4/11]

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
void MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes >::async_unsubscribe ( packet_id_t  packet_id,
std::string  topic_filter,
async_handler_t  func = {} 
)
inline

Unsubscribe.

Parameters
packet_idpacket identifier. It should be acquired by acquire_unique_packet_id, or register_packet_id. The ownership of the packet_id moves to the library.
topic_filtertopic_filter
funcfunctor object who's operator() will be called when the async operation completes. You can subscribe multiple topics all at once.
See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901161

◆ async_unsubscribe() [5/11]

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
void MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes >::async_unsubscribe ( packet_id_t  packet_id,
std::vector< as::const_buffer >  params,
async_handler_t  func 
)
inline

Unsubscribe.

Parameters
packet_idpacket identifier. It should be acquired by acquire_unique_packet_id, or register_packet_id. The ownership of the packet_id moves to the library.
paramsA collection of the topic filter to unsubscribe
funcfunctor object who's operator() will be called when the async operation completes. This object may hold the lifetime of the buffers for topic_filter and contents. You can subscribe multiple topics all at once.
See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901179

◆ async_unsubscribe() [6/11]

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
void MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes >::async_unsubscribe ( packet_id_t  packet_id,
std::vector< as::const_buffer >  params,
v5::properties  props,
async_handler_t  func 
)
inline

Unsubscribe.

Parameters
packet_idpacket identifier. It should be acquired by acquire_unique_packet_id, or register_packet_id. The ownership of the packet_id moves to the library.
paramsA collection of the topic filter to unsubscribe
propsProperties
See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901182
3.10.2.1 UNSUBSCRIBE Properties
funcfunctor object who's operator() will be called when the async operation completes. This object should hold the lifetime of the buffers for params. You can subscribe multiple topics all at once.
See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901179

◆ async_unsubscribe() [7/11]

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
void MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes >::async_unsubscribe ( packet_id_t  packet_id,
std::vector< buffer params,
async_handler_t  func = {} 
)
inline

Unsubscribe.

Parameters
packet_idpacket identifier. It should be acquired by acquire_unique_packet_id, or register_packet_id. The ownership of the packet_id moves to the library.
paramsA collection of the topic filter to unsubscribe
funcfunctor object who's operator() will be called when the async operation completes. You can subscribe multiple topics all at once.
See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901179

◆ async_unsubscribe() [8/11]

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
void MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes >::async_unsubscribe ( packet_id_t  packet_id,
std::vector< buffer params,
v5::properties  props,
async_handler_t  func = {} 
)
inline

Unsubscribe.

Parameters
packet_idpacket identifier. It should be acquired by acquire_unique_packet_id, or register_packet_id. The ownership of the packet_id moves to the library.
paramsA collection of the topic filter to unsubscribe
propsProperties
See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901182
3.10.2.1 UNSUBSCRIBE Properties
funcfunctor object who's operator() will be called when the async operation completes. You can subscribe multiple topics all at once.
See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901179

◆ async_unsubscribe() [9/11]

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
void MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes >::async_unsubscribe ( packet_id_t  packet_id,
std::vector< std::string >  params,
async_handler_t  func = {} 
)
inline

Unsubscribe.

Parameters
packet_idpacket identifier. It should be acquired by acquire_unique_packet_id, or register_packet_id. The ownership of the packet_id moves to the library.
paramsA collection of the topic filter to unsubscribe
funcfunctor object who's operator() will be called when the async operation completes. You can subscribe multiple topics all at once.
See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901179

◆ async_unsubscribe() [10/11]

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
void MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes >::async_unsubscribe ( packet_id_t  packet_id,
std::vector< std::string >  params,
v5::properties  props,
async_handler_t  func = {} 
)
inline

Unsubscribe.

Parameters
packet_idpacket identifier. It should be acquired by acquire_unique_packet_id, or register_packet_id. The ownership of the packet_id moves to the library.
paramsA collection of the topic filter to unsubscribe
propsProperties
See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901182
3.10.2.1 UNSUBSCRIBE Properties
funcfunctor object who's operator() will be called when the async operation completes. You can subscribe multiple topics all at once.
See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901179

◆ async_unsubscribe() [11/11]

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
template<typename T , typename... Params>
std::enable_if_t< ! std::is_convertible<std::decay_t<T>, packet_id_t>::value > MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes >::async_unsubscribe ( T &&  t,
Params &&...  params 
)
inline

Unsubscribe.

Parameters
topic_nameA topic name to unsubscribe
funcfunctor object who's operator() will be called when the async operation completes. packet_id is automatically generated.
You can subscribe multiple topics all at once.
See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901179

◆ auth()

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
void MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes >::auth ( v5::auth_reason_code  reason_code = v5::auth_reason_code::success,
v5::properties  props = {} 
)
inline

◆ clean_session()

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
bool MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes >::clean_session ( ) const
inline

Get clean session.

See http://docs.oasis-open.org/mqtt/mqtt/v3.1.1/os/mqtt-v3.1.1-os.html#_Toc385349231
3.1.2.4 Clean Session
After constructing a endpoint, the clean session is set to false.

Returns
clean session

◆ clean_start()

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
bool MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes >::clean_start ( ) const
inline

Get clean start.

See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901039
3.1.2.4 Clean Start
After constructing a endpoint, the clean start is set to false.

Returns
clean start

◆ clear_session_data()

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
void MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes >::clear_session_data ( )
inlineprotected

◆ clear_stored_publish()

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
void MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes >::clear_stored_publish ( packet_id_t  packet_id)
inline

Clear stored publish message that has packet_id.

Parameters
packet_idpacket id corresponding to stored publish

◆ connack()

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
void MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes >::connack ( bool  session_present,
variant< connect_return_code, v5::connect_reason_code reason_code,
v5::properties  props = {} 
)
inline

◆ connect() [1/2]

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
void MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes >::connect ( buffer  client_id,
optional< buffer user_name,
optional< buffer password,
optional< will w,
std::uint16_t  keep_alive_sec,
v5::properties  props = {} 
)
inline

◆ connect() [2/2]

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
void MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes >::connect ( std::string const &  client_id,
optional< std::string > const &  user_name,
optional< std::string > const &  password,
optional< will w,
std::uint16_t  keep_alive_sec,
v5::properties  props = {} 
)
inline

◆ connected()

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
bool MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes >::connected ( ) const
inline

Check connection status.

Returns
current connection status

◆ disconnect()

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
void MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes >::disconnect ( v5::disconnect_reason_code  reason = v5::disconnect_reason_code::normal_disconnection,
v5::properties  props = {} 
)
inline

Disconnect Send a disconnect packet to the connected broker. It is a clean disconnecting sequence. The broker disconnects the endpoint after receives the disconnect packet.
When the endpoint disconnects using disconnect(), a will won't send.
See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901205

Parameters
reason_codeDISCONNECT Reason Code
See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901208
3.14.2.1 Disconnect Reason Code
propsProperties
See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901209
3.14.2.2 DISCONNECT Properties

◆ for_each_store() [1/2]

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
void MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes >::for_each_store ( std::function< void(basic_store_message_variant< PacketIdBytes >)> const &  f)
inline

Apply f to stored messages.

Parameters
fapplying function. f should be void(store_message_variant)

◆ for_each_store() [2/2]

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
void MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes >::for_each_store ( std::function< void(char const *, std::size_t)> const &  f)
inline

Apply f to stored messages.

Parameters
fapplying function. f should be void(char const*, std::size_t)

◆ for_each_store_with_life_keeper()

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
void MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes >::for_each_store_with_life_keeper ( std::function< void(basic_store_message_variant< PacketIdBytes >, any)> const &  f)
inline

Apply f to stored messages.

Parameters
fapplying function. f should be void(store_message_variant, any)

◆ force_disconnect()

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
void MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes >::force_disconnect ( )
inline

Disconnect by endpoint Force disconnect. It is not a clean disconnect sequence.
When the endpoint disconnects using force_disconnect(), a will will send.

◆ get_executor()

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
auto MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes >::get_executor ( )
inline

◆ get_protocol_version()

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
protocol_version MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes >::get_protocol_version ( ) const
inline

◆ get_total_bytes_received()

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
std::size_t MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes >::get_total_bytes_received ( ) const
inline

get_total_bytes_received

Returns
The total bytes received on the socket.

◆ get_total_bytes_sent()

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
std::size_t MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes >::get_total_bytes_sent ( ) const
inline

get_total_bytes_sent

Returns
The total bytes sent on the socket.

◆ handle_close_or_error()

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
bool MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes >::handle_close_or_error ( error_code  ec)
inlineprotected

◆ on_close()

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
virtual void MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes >::on_close ( )
protectedpure virtualnoexcept

Close handler.

This handler is called if the client called disconnect() and the server closed the socket cleanly. If the socket is closed by other reasons, error_handler is called.

Implemented in MQTT_NS::server_endpoint< Mutex, LockGuard, PacketIdBytes >, MQTT_NS::client< Socket, PacketIdBytes >, and MQTT_NS::client< Socket, 2 >.

◆ on_error()

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
virtual void MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes >::on_error ( error_code  ec)
protectedpure virtualnoexcept

Error handler.

This handler is called if the socket is closed without client's disconnect() call.

Parameters
ecerror code

Implemented in MQTT_NS::server_endpoint< Mutex, LockGuard, PacketIdBytes >, MQTT_NS::client< Socket, PacketIdBytes >, and MQTT_NS::client< Socket, 2 >.

◆ on_mqtt_message_processed()

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
virtual MQTT_ALWAYS_INLINE void MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes >::on_mqtt_message_processed ( any  session_life_keeper)
inlineprotectedvirtual

next read handler This handler is called when the current mqtt message has been processed.

Parameters
funcA callback function that is called when async operation will finish.

◆ on_pre_send()

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
virtual void MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes >::on_pre_send ( )
protectedpure virtualnoexcept

Pre-send handler This handler is called when any mqtt control packet is decided to send.

Implemented in MQTT_NS::server_endpoint< Mutex, LockGuard, PacketIdBytes >, MQTT_NS::client< Socket, PacketIdBytes >, and MQTT_NS::client< Socket, 2 >.

◆ operator=() [1/2]

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
endpoint& MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes >::operator= ( this_type &&  )
delete

◆ operator=() [2/2]

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
endpoint& MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes >::operator= ( this_type const &  )
delete

◆ pingreq()

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
void MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes >::pingreq ( )
inline

◆ pingresp()

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
void MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes >::pingresp ( )
inline

Send pingresp packet. This function is for broker. See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901200.

◆ puback()

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
void MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes >::puback ( packet_id_t  packet_id,
v5::puback_reason_code  reason_code = v5::puback_reason_code::success,
v5::properties  props = {} 
)
inline

Send puback packet.

Parameters
packet_idpacket id corresponding to publish
reason_codePUBACK Reason Code
See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901124
3.4.2.1 PUBACK Reason Code
propsProperties
See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901125
3.4.2.2 PUBACK Properties

◆ pubcomp()

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
void MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes >::pubcomp ( packet_id_t  packet_id,
v5::pubcomp_reason_code  reason_code = v5::pubcomp_reason_code::success,
v5::properties  props = {} 
)
inline

Send pubcomp packet.

Parameters
packet_idpacket id corresponding to publish
reason_codePUBCOMP Reason Code
See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901154
3.7.2.1 PUBCOMP Reason Code
propsProperties
See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901155
3.7.2.2 PUBCOMP Properties

◆ publish() [1/6]

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
template<typename ConstBufferSequence >
std::enable_if< as::is_const_buffer_sequence<ConstBufferSequence>::value >::type MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes >::publish ( packet_id_t  packet_id,
as::const_buffer  topic_name,
ConstBufferSequence  contents,
publish_options  pubopts,
any  life_keeper 
)
inline

Publish with already acquired packet identifier.

Parameters
packet_idpacket identifier. It should be acquired by acquire_unique_packet_id, or register_packet_id. The ownership of the packet_id moves to the library. If qos == qos::at_most_once, packet_id must be 0. But not checked in release mode due to performance.
topic_nameA topic name to publish
contentsThe contents or the range of the contents to publish
puboptsqos, retain flag, and dup flag.
life_keeperAn object that stays alive as long as the library holds a reference to any other parameters. If topic_name, contents, or props do not have built-in lifetime management, (e.g. buffer) use this parameter to manage their lifetime.
Note
If your QOS level is exactly_once or at_least_once, then the library will store this publish internally until the broker has confirmed delivery, which may involve resends, and as such the life_keeper parameter is important.

◆ publish() [2/6]

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
template<typename ConstBufferSequence >
std::enable_if< as::is_const_buffer_sequence<ConstBufferSequence>::value >::type MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes >::publish ( packet_id_t  packet_id,
as::const_buffer  topic_name,
ConstBufferSequence  contents,
publish_options  pubopts,
v5::properties  props,
any  life_keeper 
)
inline

Publish with already acquired packet identifier.

Parameters
packet_idpacket identifier. It should be acquired by acquire_unique_packet_id, or register_packet_id. The ownership of the packet_id moves to the library. If qos == qos::at_most_once, packet_id must be 0. But not checked in release mode due to performance.
topic_nameA topic name to publish
contentsThe contents or the range of the contents to publish
puboptsqos, retain flag, and dup flag.
propsProperties
See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901109
3.3.2.3 PUBLISH Properties
life_keeperAn object that stays alive as long as the library holds a reference to any other parameters. If topic_name, contents, or props do not have built-in lifetime management, (e.g. buffer) use this parameter to manage their lifetime.
Note
If your QOS level is exactly_once or at_least_once, then the library will store this publish internally until the broker has confirmed delivery, which may involve resends, and as such the life_keeper parameter is important.

◆ publish() [3/6]

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
template<typename BufferSequence >
std::enable_if< is_buffer_sequence<BufferSequence>::value >::type MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes >::publish ( packet_id_t  packet_id,
buffer  topic_name,
BufferSequence  contents,
publish_options  pubopts,
v5::properties  props,
any  life_keeper = {} 
)
inline

Publish with already acquired packet identifier.

Parameters
packet_idpacket identifier. It should be acquired by acquire_unique_packet_id, or register_packet_id. The ownership of the packet_id moves to the library. If qos == qos::at_most_once, packet_id must be 0. But not checked in release mode due to performance.
topic_nameA topic name to publish
contentsThe contents or the range of the contents to publish
puboptsqos, retain flag, and dup flag.
propsProperties
See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901109
3.3.2.3 PUBLISH Properties
life_keeperAn object that stays alive as long as the library holds a reference to any other parameters. If topic_name, contents, or props do not have built-in lifetime management, (e.g. buffer) use this parameter to manage their lifetime.
Note
If your QOS level is exactly_once or at_least_once, then the library will store this publish internally until the broker has confirmed delivery, which may involve resends, and as such the life_keeper parameter is important.

◆ publish() [4/6]

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
template<typename BufferSequence >
std::enable_if< is_buffer_sequence<BufferSequence>::value >::type MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes >::publish ( packet_id_t  packet_id,
buffer  topic_name,
BufferSequence  contents,
publish_options  pubopts = {},
any  life_keeper = {} 
)
inline

Publish with already acquired packet identifier.

Parameters
packet_idpacket identifier. It should be acquired by acquire_unique_packet_id, or register_packet_id. The ownership of the packet_id moves to the library. If qos == qos::at_most_once, packet_id must be 0. But not checked in release mode due to performance.
topic_nameA topic name to publish
contentsThe contents or the range of the contents to publish
puboptsqos, retain flag, and dup flag.
life_keeperAn object that stays alive as long as the library holds a reference to any other parameters. If topic_name, contents, or props do not have built-in lifetime management, (e.g. buffer) use this parameter to manage their lifetime.
Note
If your QOS level is exactly_once or at_least_once, then the library will store this publish internally until the broker has confirmed delivery, which may involve resends, and as such the life_keeper parameter is important. If topic_name and contents don't manage their lifetimes, then life_keeper should be used to keep their lifetimes.

◆ publish() [5/6]

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
void MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes >::publish ( packet_id_t  packet_id,
std::string  topic_name,
std::string  contents,
publish_options  pubopts = {},
v5::properties  props = {},
any  life_keeper = {} 
)
inline

Publish with already acquired packet identifier.

Parameters
packet_idpacket identifier. It should be acquired by acquire_unique_packet_id, or register_packet_id. The ownership of the packet_id moves to the library. If qos == qos::at_most_once, packet_id must be 0. But not checked in release mode due to performance.
topic_nameA topic name to publish
contentsThe contents to publish
puboptsqos, retain flag, and dup flag.
propsProperties
See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901109
3.3.2.3 PUBLISH Properties
life_keeperAn object that stays alive as long as the library holds a reference to any other parameters. If topic_name, contents, or props do not have built-in lifetime management, (e.g. buffer) use this parameter to manage their lifetime.
Note
If your QOS level is exactly_once or at_least_once, then the library will store this publish internally until the broker has confirmed delivery, which may involve resends, and as such the life_keeper parameter is important.

◆ publish() [6/6]

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
template<typename T , typename... Params>
std::enable_if_t< ! std::is_convertible<std::decay_t<T>, packet_id_t>::value, packet_id_t > MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes >::publish ( T &&  t,
Params &&...  params 
)
inline

Publish.

Parameters
topic_nameA topic name to publish
contentsThe contents to publish
puboptsqos, retain flag, and dup flag.
props(optional) Properties
See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901109
3.3.2.3 PUBLISH Properties
life_keeper(optional) An object that stays alive as long as the library holds a reference to any other parameters. If topic_name, contents, or props do not have built-in lifetime management, (e.g. buffer) use this parameter to manage their lifetime.
Returns
packet_id. If qos is set to at_most_once, return 0. packet_id is automatically generated.
Note
If your QOS level is exactly_once or at_least_once, then the library will store this publish internally until the broker has confirmed delivery, which may involve resends, and as such the life_keeper parameter is important.

◆ pubrec()

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
void MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes >::pubrec ( packet_id_t  packet_id,
v5::pubrec_reason_code  reason_code = v5::pubrec_reason_code::success,
v5::properties  props = {} 
)
inline

Send packet.

Parameters
packet_idpacket id corresponding to publish
reason_codeReason Code
See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901134
3.5.2.1 Reason Code
propsProperties
See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901135
3.5.2.2 Properties

◆ pubrel()

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
void MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes >::pubrel ( packet_id_t  packet_id,
v5::pubrel_reason_code  reason_code = v5::pubrel_reason_code::success,
v5::properties  props = {},
any  life_keeper = {} 
)
inline

Send pubrel packet.

Parameters
packet_idpacket id corresponding to publish
reason_codePUBREL Reason Code
See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901144
3.6.2.1 PUBREL Reason Code
propsProperties
See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901145
3.6.2.2 PUBREL Properties
life_keeperAn object that stays alive as long as the library holds a reference to any other parameters. If your props are not using built-in lifetime management, (e.g. buffer) use this parameter to manage their lifetime.
Note
The library may store this message while it communicates with the server for several round trips. As such, the life_keeper paramter is important.

◆ register_packet_id()

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
bool MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes >::register_packet_id ( packet_id_t  packet_id)
inline

Register packet_id to the library. After registering the packet_id, you can call acquired_* functions. The ownership of packet id is moved to the library. Or you can call release_packet_id to release it.

Returns
If packet_id is successfully registerd then return true, otherwise return false.

◆ release_packet_id()

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
void MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes >::release_packet_id ( packet_id_t  packet_id)
inline

Release packet_id.

Parameters
packet_idpacket id to release. only the packet_id gotten by acquire_unique_packet_id, or register_packet_id is permitted.

◆ restore_serialized_message() [1/4]

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
void MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes >::restore_serialized_message ( basic_publish_message< PacketIdBytes >  msg,
any  life_keeper = {} 
)
inline

Restore serialized publish message. This function should be called before connect.

Parameters
msgpublish message.
life_keeperAn object that stays alive (but is moved with force_move()) until the stored message is sent.

◆ restore_serialized_message() [2/4]

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
void MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes >::restore_serialized_message ( basic_pubrel_message< PacketIdBytes >  msg,
any  life_keeper = {} 
)
inline

Restore serialized pubrel message. This function should be called before connect.

Parameters
msgpubrel message.

◆ restore_serialized_message() [3/4]

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
void MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes >::restore_serialized_message ( basic_store_message_variant< PacketIdBytes >  msg,
any  life_keeper = {} 
)
inline

◆ restore_serialized_message() [4/4]

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
template<typename Iterator >
std::enable_if_t< std::is_convertible<typename Iterator::value_type, char>::value > MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes >::restore_serialized_message ( Iterator  b,
Iterator  e 
)
inline

Restore serialized publish and pubrel messages. This function should be called before connect.

Parameters
biterator begin of the message
eiterator end of the message

◆ restore_v5_serialized_message() [1/3]

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
template<typename Iterator >
std::enable_if_t< std::is_convertible<typename Iterator::value_type, char>::value > MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes >::restore_v5_serialized_message ( Iterator  b,
Iterator  e 
)
inline

Restore serialized publish and pubrel messages. This function shouold be called before connect.

Parameters
biterator begin of the message
eiterator end of the message Empty topic_name on MQTT v5 publish message is prohibited.

◆ restore_v5_serialized_message() [2/3]

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
void MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes >::restore_v5_serialized_message ( v5::basic_publish_message< PacketIdBytes >  msg,
any  life_keeper = {} 
)
inline

Restore serialized publish message. This function shouold be called before connect.

Parameters
msgpublish message. Empty topic_name is prohibited.
life_keeperAn object that stays alive (but is moved with force_move()) until the stored message is sent.

◆ restore_v5_serialized_message() [3/3]

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
void MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes >::restore_v5_serialized_message ( v5::basic_pubrel_message< PacketIdBytes >  msg,
any  life_keeper = {} 
)
inline

Restore serialized pubrel message. This function shouold be called before connect.

Parameters
msgpubrel message.
life_keeperAn object that stays alive (but is moved with force_move()) until the stored message is sent.

◆ send_store_message()

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
void MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes >::send_store_message ( basic_store_message_variant< PacketIdBytes >  msg,
any  life_keeper 
)
inline

◆ set_auto_map_topic_alias_send()

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
void MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes >::set_auto_map_topic_alias_send ( bool  b = true)
inline

Set topic alias send auto mapping enable flag.

Parameters
bset value

If set true then topic alias is automatically used. topic alias is allocated and reused by LRU algorithm. topic alias that is set manually can be used with this flag.

◆ set_auto_pub_response()

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
void MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes >::set_auto_pub_response ( bool  b = true,
bool  async = true 
)
inline

Set auto publish response mode.

Parameters
bset value
asyncauto publish ressponse send asynchronous

When set auto publish response mode to true, puback, pubrec, pubrel,and pub comp automatically send.

◆ set_auto_replace_topic_alias_send()

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
void MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes >::set_auto_replace_topic_alias_send ( bool  b = true)
inline

Set topic alias send auto replacing enable flag.

Parameters
bset value

If set true when publish without topic alias and topic alias send map has corresponding entry, then use the alias. topic alias that is set manually can be used with this flag.

◆ set_connect()

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
void MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes >::set_connect ( )
inlineprotected

◆ set_max_queue_send_count()

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
void MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes >::set_max_queue_send_count ( std::size_t  count)
inline

Set maximum number of queued message sending. When async message sending function called during asynchronous processing, the message is enqueued. When current asynchronous message is processed, then concatenate queued messages and send it. This value limits the maximum number of concatenating messages. The default value is 1.

Parameters
countmaximum number of queued message sending. 0 means infinity.

◆ set_max_queue_send_size()

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
void MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes >::set_max_queue_send_size ( std::size_t  size)
inline

Set maximum size of queued message sending. When async message sending function called during asynchronous processing, the message is enqueued. When current asynchronous message is processed, then concatenate queued messages and send it. This value limits the maximum size of concatenating messages. The default value is 0.

Parameters
sizemaximum size of queued message sending. 0 means infinity.

◆ set_packet_bulk_read_limit()

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
void MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes >::set_packet_bulk_read_limit ( std::size_t  size)
inline

◆ set_pingresp_timeout()

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
void MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes >::set_pingresp_timeout ( std::chrono::steady_clock::duration  tim)
inline

Set pingresp timeout.

Parameters
timtimeout value

If tim is not zero, when the client sends PINGREQ, set a timer. The timer cancels when PINGRESP is received. If the timer is fired, then force_disconnect from the client side.
https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901045
3.1.2.10 Keep Alive

◆ set_props_bulk_read_limit()

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
void MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes >::set_props_bulk_read_limit ( std::size_t  size)
inline

◆ set_protocol_version()

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
void MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes >::set_protocol_version ( protocol_version  version)
inlineprotected

◆ set_topic_alias_maximum()

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
void MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes >::set_topic_alias_maximum ( topic_alias_t  max)
inline

set topic alias maximum for receiving

Parameters
maxmaximum value

◆ socket() [1/2]

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
MQTT_NS::socket& MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes >::socket ( )
inline

◆ socket() [2/2]

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
MQTT_NS::socket const& MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes >::socket ( ) const
inline

◆ socket_sp_ref()

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
std::shared_ptr<MQTT_NS::socket>& MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes >::socket_sp_ref ( )
inlineprotected

Get shared_ptr of socket.

Returns
reference of std::shared_ptr<socket>

◆ start_session()

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
void MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes >::start_session ( any  session_life_keeper = any())
inline

start session with a connected endpoint.

Parameters
funcfinish handler that is called when the session is finished

◆ suback() [1/2]

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
void MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes >::suback ( packet_id_t  packet_id,
variant< std::vector< suback_return_code >, std::vector< v5::suback_reason_code >>  reasons,
v5::properties  props = {} 
)
inline

Send suback packet. This function is for broker.

Parameters
packet_idpacket id corresponding to subscribe
reasonsa collection of reason_code
See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901178
3.9.3 SUBACK Payload
propsProperties
See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901174
3.9.2.1 SUBACK Properties

◆ suback() [2/2]

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
void MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes >::suback ( packet_id_t  packet_id,
variant< suback_return_code, v5::suback_reason_code reason,
v5::properties  props = {} 
)
inline

Send suback packet. This function is for broker.

Parameters
packet_idpacket id corresponding to subscribe
reasonreason_code
See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901178
3.9.3 SUBACK Payload
propsProperties
See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901174
3.9.2.1 SUBACK Properties

◆ subscribe() [1/5]

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
void MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes >::subscribe ( packet_id_t  packet_id,
as::const_buffer  topic_filter,
subscribe_options  option,
v5::properties  props = {} 
)
inline

Subscribe with already acquired packet identifier.

Parameters
packet_idpacket identifier. It should be acquired by acquire_unique_packet_id, or register_packet_id. The ownership of the packet_id moves to the library.
topic_filterA topic filter to subscribe
optionsubscription options
See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901169
3.8.3.1 Subscription Options
propsProperties
See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901164
3.8.2.1 SUBSCRIBE Properties You can subscribe multiple topics all at once.
See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901161

◆ subscribe() [2/5]

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
void MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes >::subscribe ( packet_id_t  packet_id,
std::vector< std::tuple< buffer, subscribe_options >>  params,
v5::properties  props = {} 
)
inline

Subscribe with already acquired packet identifier.

Parameters
packet_idpacket identifier. It should be acquired by acquire_unique_packet_id, or register_packet_id. The ownership of the packet_id moves to the library.
paramsa vector of the subscribe_entry.
propsProperties
See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901164
3.8.2.1 SUBSCRIBE Properties You can subscribe multiple topics all at once.
See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901161

◆ subscribe() [3/5]

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
void MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes >::subscribe ( packet_id_t  packet_id,
std::vector< std::tuple< string_view, subscribe_options >>  params,
v5::properties  props = {} 
)
inline

Subscribe with already acquired packet identifier.

Parameters
packet_idpacket identifier. It should be acquired by acquire_unique_packet_id, or register_packet_id. The ownership of the packet_id moves to the library.
paramsa vector of the topic_filter and qos pair.
propsProperties
See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901164
3.8.2.1 SUBSCRIBE Properties You can subscribe multiple topics all at once.
See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901161

◆ subscribe() [4/5]

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
void MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes >::subscribe ( packet_id_t  packet_id,
string_view  topic_filter,
subscribe_options  option,
v5::properties  props = {} 
)
inline

Subscribe with already acquired packet identifier.

Parameters
packet_idpacket identifier. It should be acquired by acquire_unique_packet_id, or register_packet_id. The ownership of the packet_id moves to the library.
topic_filterA topic filter to subscribe
optionsubscription options
See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901169
3.8.3.1 Subscription Options
propsProperties
See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901164
3.8.2.1 SUBSCRIBE Properties You can subscribe multiple topics all at once.
See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901161

◆ subscribe() [5/5]

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
template<typename T , typename... Params>
std::enable_if_t< ! std::is_convertible<std::decay_t<T>, packet_id_t>::value, packet_id_t > MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes >::subscribe ( T &&  t,
Params &&...  params 
)
inline

Subscribe.

Parameters
topic_nameA topic name to subscribe
optionsubscription options
See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901169
3.8.3.1 Subscription Options
propsProperties
See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901164
3.8.2.1 SUBSCRIBE Properties
Returns
packet_id. packet_id is automatically generated.
You can subscribe multiple topics all at once.
See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901161

◆ underlying_connected()

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
bool MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes >::underlying_connected ( ) const
inline

Check underlying layer connection status.

Returns
current connection status

◆ unsuback() [1/3]

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
void MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes >::unsuback ( packet_id_t  packet_id)
inline

Send unsuback packet. This function is for broker.

Parameters
packet_idpacket id corresponding to subscribe

◆ unsuback() [2/3]

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
void MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes >::unsuback ( packet_id_t  packet_id,
std::vector< v5::unsuback_reason_code reasons,
v5::properties  props = {} 
)
inline

Send unsuback packet. This function is for broker.

Parameters
packet_idpacket id corresponding to subscribe
reasonsa collection of reason_code
See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901194
3.11.3 UNSUBACK Payload
propsProperties
See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901190
3.11.2.1 UNSUBACK Properties

◆ unsuback() [3/3]

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
void MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes >::unsuback ( packet_id_t  packet_id,
v5::unsuback_reason_code  reason,
v5::properties  props = {} 
)
inline

Send unsuback packet. This function is for broker.

Parameters
packet_idpacket id corresponding to subscribe
reasonreason_code
See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901194
3.11.3 UNSUBACK Payload
propsProperties
See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901190
3.11.2.1 UNSUBACK Properties

◆ unsubscribe() [1/6]

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
void MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes >::unsubscribe ( packet_id_t  packet_id,
as::const_buffer  topic_filter,
v5::properties  props = {} 
)
inline

Unsubscribe with already acquired packet identifier.

Parameters
packet_idpacket identifier. It should be acquired by acquire_unique_packet_id, or register_packet_id. The ownership of the packet_id moves to the library.
topic_filterA topic filter to unsubscribe
propsProperties
See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901182
3.10.2.1 UNSUBSCRIBE Properties You can subscribe multiple topics all at once.
See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901179

◆ unsubscribe() [2/6]

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
void MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes >::unsubscribe ( packet_id_t  packet_id,
std::vector< as::const_buffer >  params,
v5::properties  props = {} 
)
inline

Unsubscribe with already acquired packet identifier.

Parameters
packet_idpacket identifier. It should be acquired by acquire_unique_packet_id, or register_packet_id. The ownership of the packet_id moves to the library.
paramsa collection of topic_filter
propsProperties
See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901182
3.10.2.1 UNSUBSCRIBE Properties You can subscribe multiple topics all at once.
See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901179

◆ unsubscribe() [3/6]

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
void MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes >::unsubscribe ( packet_id_t  packet_id,
std::vector< buffer params,
v5::properties  props = {} 
)
inline

Unsubscribe with already acquired packet identifier.

Parameters
packet_idpacket identifier. It should be acquired by acquire_unique_packet_id, or register_packet_id. The ownership of the packet_id moves to the library.
paramsa collection of topic_filter
propsProperties
See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901182
3.10.2.1 UNSUBSCRIBE Properties You can subscribe multiple topics all at once.
See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901179

◆ unsubscribe() [4/6]

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
void MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes >::unsubscribe ( packet_id_t  packet_id,
std::vector< string_view params,
v5::properties  props = {} 
)
inline

Unsubscribe with already acquired packet identifier.

Parameters
packet_idpacket identifier. It should be acquired by acquire_unique_packet_id, or register_packet_id. The ownership of the packet_id moves to the library.
paramsa collection of topic_filter
propsProperties
See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901182
3.10.2.1 UNSUBSCRIBE Properties You can subscribe multiple topics all at once.
See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901179

◆ unsubscribe() [5/6]

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
void MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes >::unsubscribe ( packet_id_t  packet_id,
string_view  topic_filter,
v5::properties  props = {} 
)
inline

Unsubscribe with already acquired packet identifier.

Parameters
packet_idpacket identifier. It should be acquired by acquire_unique_packet_id, or register_packet_id. The ownership of the packet_id moves to the library.
topic_filterA topic filter to unsubscribe
propsProperties
See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901182
3.10.2.1 UNSUBSCRIBE Properties You can subscribe multiple topics all at once.
See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901179

◆ unsubscribe() [6/6]

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
template<typename T , typename... Params>
std::enable_if_t< ! std::is_convertible<std::decay_t<T>, packet_id_t>::value, packet_id_t > MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes >::unsubscribe ( T &&  t,
Params &&...  params 
)
inline

Unsubscribe.

Parameters
topic_nameA topic name to unsubscribe
propsProperties
See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901182
3.10.2.1 UNSUBSCRIBE Properties
Returns
packet_id. packet_id is automatically generated.
You can subscribe multiple topics all at once.
See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901179

Friends And Related Function Documentation

◆ process_auth

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
friend struct process_auth
friend

◆ process_connack

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
friend struct process_connack
friend

◆ process_connect

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
friend struct process_connect
friend

◆ process_disconnect

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
friend struct process_disconnect
friend

◆ process_puback

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
friend struct process_puback
friend

◆ process_pubcomp

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
friend struct process_pubcomp
friend

◆ process_publish

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
friend struct process_publish
friend

◆ process_pubrec

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
friend struct process_pubrec
friend

◆ process_pubrel

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
friend struct process_pubrel
friend

◆ process_suback

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
friend struct process_suback
friend

◆ process_subscribe

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
friend struct process_subscribe
friend

◆ process_unsuback

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
friend struct process_unsuback
friend

◆ process_unsubscribe

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
friend struct process_unsubscribe
friend

Member Data Documentation

◆ clean_start_

template<typename Mutex = std::mutex, template< typename... > class LockGuard = std::lock_guard, std::size_t PacketIdBytes = 2>
bool MQTT_NS::endpoint< Mutex, LockGuard, PacketIdBytes >::clean_start_ {false}
protected

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