async_mqtt 9.0.1
Loading...
Searching...
No Matches
async_mqtt::basic_endpoint< Role, PacketIdBytes, NextLayer > Class Template Reference

MQTT endpoint corresponding to the connection. More...

Classes

struct  rebind_executor
 rebinds the basic_endpoint type to another executor More...
 

Public Types

using next_layer_type = typename stream_type::next_layer_type
 type of the given NextLayer
 
using lowest_layer_type = typename stream_type::lowest_layer_type
 lowest_layer_type of the given NextLayer
 
using executor_type = typename next_layer_type::executor_type
 executor_type of the given NextLayer
 
using packet_variant_type = basic_packet_variant<PacketIdBytes>
 Type of packet_variant.
 

Public Member Functions

template<typename... Args>
 basic_endpoint (protocol_version ver, Args &&... args)
 constructor
 
 ~basic_endpoint ()
 destructor This function destroys the basic_endpoint, cancelling any outstanding asynchronous operations associated with the basic_endpoint.
 
 basic_endpoint (this_type const &)=delete
 copy constructor deleted
 
 basic_endpoint (this_type &&)=default
 move constructor
 
this_typeoperator= (this_type const &)=delete
 copy assign operator deleted
 
this_typeoperator= (this_type &&)=default
 move assign operator
 
as::any_io_executor get_executor ()
 executor getter
 
next_layer_type const & next_layer () const
 next_layer getter
 
next_layer_typenext_layer ()
 next_layer getter
 
lowest_layer_type const & lowest_layer () const
 lowest_layer getter
 
lowest_layer_typelowest_layer ()
 lowest_layer getter
 
void set_auto_pub_response (bool val)
 auto publish response setter. Should be called before send()/recv() call.
 
void set_auto_ping_response (bool val)
 auto pingreq response setter. Should be called before send()/recv() call.
 
void set_auto_map_topic_alias_send (bool val)
 auto map (allocate) topic alias on send PUBLISH packet. If all topic aliases are used, then overwrite by LRU algorithm.
This function should be called before send() call.
 
void set_auto_replace_topic_alias_send (bool val)
 auto replace topic with corresponding topic alias on send PUBLISH packet. Registering topic alias need to do manually.
This function should be called before send() call.
 
void set_pingresp_recv_timeout (std::chrono::milliseconds duration)
 Set timeout for receiving PINGRESP packet after PINGREQ packet is sent. If the timer is fired, then the underlying layer is closed from the client side. If the protocol_version is v5, then send DISCONNECT packet with the reason code disconnect_reason_code::keep_alive_timeout automatically before underlying layer is closed.
This function should be called before send() call.
 
void set_bulk_write (bool val)
 Set bulk write mode. If true, then concatenate multiple packets' const buffer sequence when send() is called before the previous send() is not completed. Otherwise, send packet one by one.
This function should be called before send() call.
 
void set_bulk_read_buffer_size (std::size_t val)
 Set the bulk read buffer size. If bulk read is enabled, the val parameter specifies the size of the internal async_read_some() buffer. Enabling bulk read can improve throughput but may increase latency. Disabling bulk read can reduce latency but may lower throughput. By default, bulk read is disabled.
 
template<typename CompletionToken = as::default_completion_token_t<executor_type>>
 async_acquire_unique_packet_id (CompletionToken &&token=as::default_completion_token_t< executor_type >{})
 acuire unique packet_id.
 
template<typename CompletionToken = as::default_completion_token_t<executor_type>>
 async_acquire_unique_packet_id_wait_until (CompletionToken &&token=as::default_completion_token_t< executor_type >{})
 acuire unique packet_id. If packet_id is fully acquired, then wait until released.
 
template<typename CompletionToken = as::default_completion_token_t<executor_type>>
 async_register_packet_id (typename basic_packet_id_type< PacketIdBytes >::type packet_id, CompletionToken &&token=as::default_completion_token_t< executor_type >{})
 register packet_id.
 
template<typename CompletionToken = as::default_completion_token_t<executor_type>>
 async_release_packet_id (typename basic_packet_id_type< PacketIdBytes >::type packet_id, CompletionToken &&token=as::default_completion_token_t< executor_type >{})
 release packet_id.
 
template<typename Packet , typename CompletionToken = as::default_completion_token_t<executor_type>>
 async_send (Packet packet, CompletionToken &&token=as::default_completion_token_t< executor_type >{})
 send packet users can call send() before the previous send()'s CompletionToken is invoked
 
template<typename CompletionToken = as::default_completion_token_t<executor_type>>
 async_recv (CompletionToken &&token=as::default_completion_token_t< executor_type >{})
 receive packet
 
template<typename CompletionToken = as::default_completion_token_t<executor_type>>
 async_recv (std::set< control_packet_type > types, CompletionToken &&token=as::default_completion_token_t< executor_type >{})
 receive packet if packet is not filterd, then next recv() starts automatically. if receive error happenes, then token would be invoked.
 
template<typename CompletionToken = as::default_completion_token_t<executor_type>>
 async_recv (filter fil, std::set< control_packet_type > types, CompletionToken &&token=as::default_completion_token_t< executor_type >{})
 receive packet if packet is not filterd, then next recv() starts automatically. if receive error happenes, then token would be invoked.
 
template<typename CompletionToken = as::default_completion_token_t<executor_type>>
 async_close (CompletionToken &&token=as::default_completion_token_t< executor_type >{})
 close the underlying connection
 
template<typename CompletionToken = as::default_completion_token_t<executor_type>>
 async_restore_packets (std::vector< basic_store_packet_variant< PacketIdBytes > > pvs, CompletionToken &&token=as::default_completion_token_t< executor_type >{})
 restore packets the restored packets would automatically send when CONNACK packet is received
 
template<typename CompletionToken = as::default_completion_token_t<executor_type>>
 async_get_stored_packets (CompletionToken &&token=as::default_completion_token_t< executor_type >{})
 get stored packets
 
template<typename CompletionToken = as::default_completion_token_t<executor_type>>
 async_regulate_for_store (v5::basic_publish_packet< PacketIdBytes > packet, CompletionToken &&token=as::default_completion_token_t< executor_type >{})
 regulate publish packet for store remove topic alias from the packet and extract the topic name
 
std::optional< typename basic_packet_id_type< PacketIdBytes >::type > acquire_unique_packet_id ()
 acuire unique packet_id.
 
bool register_packet_id (typename basic_packet_id_type< PacketIdBytes >::type packet_id)
 register packet_id.
 
void release_packet_id (typename basic_packet_id_type< PacketIdBytes >::type packet_id)
 release packet_id.
 
std::set< typename basic_packet_id_type< PacketIdBytes >::type > get_qos2_publish_handled_pids () const
 Get processed but not released QoS2 packet ids This function should be called after disconnection.
 
void restore_qos2_publish_handled_pids (std::set< typename basic_packet_id_type< PacketIdBytes >::type > pids)
 Restore processed but not released QoS2 packet ids This function should be called before receive the first publish.
 
void restore_packets (std::vector< basic_store_packet_variant< PacketIdBytes > > pvs)
 restore packets the restored packets would automatically send when CONNACK packet is received
 
std::vector< basic_store_packet_variant< PacketIdBytes > > get_stored_packets () const
 get stored packets sotred packets mean inflight packets.
 
protocol_version get_protocol_version () const
 get MQTT protocol version
 
bool is_publish_processing (typename basic_packet_id_type< PacketIdBytes >::type pid) const
 Get MQTT PUBLISH packet processing status.
 
void regulate_for_store (v5::basic_publish_packet< PacketIdBytes > &packet, error_code &ec) const
 Regulate publish packet for store If topic is empty, extract topic from topic alias, and remove topic alias Otherwise, remove topic alias if exists.
 
void set_pingreq_send_interval (std::chrono::milliseconds duration)
 Set PINGREQ packet sending interval.
 

Related Symbols

(Note that these are not member symbols.)

template<role Role, typename NextLayer >
using endpoint = basic_endpoint<Role, 2, NextLayer>
 Type alias of basic_endpoint (PacketIdBytes=2). This is for typical usecase.
 

Detailed Description

template<role Role, std::size_t PacketIdBytes, typename NextLayer>
class async_mqtt::basic_endpoint< Role, PacketIdBytes, NextLayer >

MQTT endpoint corresponding to the connection.

Thread Safety

  • Distinct objects: Safe
  • Shared objects: Unsafe

Requirements

Template Parameters
Rolerole for packet sendable checking
PacketIdBytesMQTT spec is 2. You can use endpoint for that.
NextLayerJust next layer for basic_endpoint. mqtt, mqtts, ws, and wss are predefined.

Constructor & Destructor Documentation

◆ basic_endpoint()

template<role Role, std::size_t PacketIdBytes, typename NextLayer >
template<typename... Args>
async_mqtt::basic_endpoint< Role, PacketIdBytes, NextLayer >::basic_endpoint ( protocol_version ver,
Args &&... args )
explicit

constructor

Template Parameters
ArgsTypes for the next layer
Parameters
verMQTT protocol version client can set v5 or v3_1_1, in addition server can set undetermined
argsargs for the next layer.

Member Function Documentation

◆ acquire_unique_packet_id()

template<role Role, std::size_t PacketIdBytes, typename NextLayer >
std::optional< typename basic_packet_id_type< PacketIdBytes >::type > async_mqtt::basic_endpoint< Role, PacketIdBytes, NextLayer >::acquire_unique_packet_id ( )

acuire unique packet_id.

Returns
std::optional<typename basic_packet_id_type<PacketIdBytes>::type> if acquired return acquired packet id, otherwise std::nullopt

◆ async_acquire_unique_packet_id()

template<role Role, std::size_t PacketIdBytes, typename NextLayer >
template<typename CompletionToken = as::default_completion_token_t<executor_type>>
async_mqtt::basic_endpoint< Role, PacketIdBytes, NextLayer >::async_acquire_unique_packet_id ( CompletionToken && token = as::default_completion_token_t< executor_type >{})

acuire unique packet_id.

Parameters
token
  • CompletionToken
    • Signature: void(error_code, typename basic_packet_id_type<PacketIdBytes>::type)
Returns
deduced by token
Per-Operation Cancellation

This asynchronous operation supports cancellation for the following boost::asio::cancellation_type values:

  • cancellation_type::terminal
  • cancellation_type::partial
  • cancellation_type::total

◆ async_acquire_unique_packet_id_wait_until()

template<role Role, std::size_t PacketIdBytes, typename NextLayer >
template<typename CompletionToken = as::default_completion_token_t<executor_type>>
async_mqtt::basic_endpoint< Role, PacketIdBytes, NextLayer >::async_acquire_unique_packet_id_wait_until ( CompletionToken && token = as::default_completion_token_t< executor_type >{})

acuire unique packet_id. If packet_id is fully acquired, then wait until released.

Parameters
token
  • CompletionToken
    • Signature: void(error_code, typename basic_packet_id_type<PacketIdBytes>::type)
Returns
deduced by token
Per-Operation Cancellation

This asynchronous operation supports cancellation for the following boost::asio::cancellation_type values:

  • cancellation_type::terminal
  • cancellation_type::partial
  • cancellation_type::total

◆ async_close()

template<role Role, std::size_t PacketIdBytes, typename NextLayer >
template<typename CompletionToken = as::default_completion_token_t<executor_type>>
async_mqtt::basic_endpoint< Role, PacketIdBytes, NextLayer >::async_close ( CompletionToken && token = as::default_completion_token_t< executor_type >{})

close the underlying connection

Parameters
token
  • CompletionToken
    • Signature: void()
Returns
deduced by token
Per-Operation Cancellation

This asynchronous operation supports cancellation for the following boost::asio::cancellation_type values:

  • cancellation_type::terminal
  • cancellation_type::partial

◆ async_get_stored_packets()

template<role Role, std::size_t PacketIdBytes, typename NextLayer >
template<typename CompletionToken = as::default_completion_token_t<executor_type>>
async_mqtt::basic_endpoint< Role, PacketIdBytes, NextLayer >::async_get_stored_packets ( CompletionToken && token = as::default_completion_token_t< executor_type >{})

get stored packets

  • stored packets mean inflight packets.
    • PUBLISH packet (QoS1) not received PUBACK packet
    • PUBLISH packet (QoS2) not received PUBREC packet
    • PUBREL packet not received PUBCOMP packet
Parameters
token
  • CompletionToken
    • Signature: void(error_code, std::vector<basic_store_packet_variant<PacketIdBytes>>)
Returns
deduced by token
Per-Operation Cancellation

This asynchronous operation supports cancellation for the following boost::asio::cancellation_type values:

  • cancellation_type::terminal
  • cancellation_type::partial
  • cancellation_type::total

◆ async_recv() [1/3]

template<role Role, std::size_t PacketIdBytes, typename NextLayer >
template<typename CompletionToken = as::default_completion_token_t<executor_type>>
async_mqtt::basic_endpoint< Role, PacketIdBytes, NextLayer >::async_recv ( CompletionToken && token = as::default_completion_token_t< executor_type >{})

receive packet

Parameters
token
  • CompletionToken
    • Signature: void(error_code, packet_variant_type)
Returns
deduced by token
Per-Operation Cancellation

This asynchronous operation supports cancellation for the following boost::asio::cancellation_type values:

  • cancellation_type::terminal
  • cancellation_type::partial

if they are also supported by the NextLayer type's async_read_some operation.

◆ async_recv() [2/3]

template<role Role, std::size_t PacketIdBytes, typename NextLayer >
template<typename CompletionToken = as::default_completion_token_t<executor_type>>
async_mqtt::basic_endpoint< Role, PacketIdBytes, NextLayer >::async_recv ( filter fil,
std::set< control_packet_type > types,
CompletionToken && token = as::default_completion_token_t< executor_type >{} )

receive packet if packet is not filterd, then next recv() starts automatically. if receive error happenes, then token would be invoked.

Parameters
filif match then matched types are targets. if except then not matched types are targets.
typestarget control_packet_types
token
  • CompletionToken
    • Signature: void(error_code, packet_variant_type)
Returns
deduced by token
Per-Operation Cancellation

This asynchronous operation supports cancellation for the following boost::asio::cancellation_type values:

  • cancellation_type::terminal
  • cancellation_type::partial

if they are also supported by the NextLayer type's async_read_some operation.

◆ async_recv() [3/3]

template<role Role, std::size_t PacketIdBytes, typename NextLayer >
template<typename CompletionToken = as::default_completion_token_t<executor_type>>
async_mqtt::basic_endpoint< Role, PacketIdBytes, NextLayer >::async_recv ( std::set< control_packet_type > types,
CompletionToken && token = as::default_completion_token_t< executor_type >{} )

receive packet if packet is not filterd, then next recv() starts automatically. if receive error happenes, then token would be invoked.

Parameters
typestarget control_packet_types
token
  • CompletionToken
    • Signature: void(error_code, packet_variant_type)
Returns
deduced by token
Per-Operation Cancellation

This asynchronous operation supports cancellation for the following boost::asio::cancellation_type values:

  • cancellation_type::terminal
  • cancellation_type::partial

if they are also supported by the NextLayer type's async_read_some operation.

◆ async_register_packet_id()

template<role Role, std::size_t PacketIdBytes, typename NextLayer >
template<typename CompletionToken = as::default_completion_token_t<executor_type>>
async_mqtt::basic_endpoint< Role, PacketIdBytes, NextLayer >::async_register_packet_id ( typename basic_packet_id_type< PacketIdBytes >::type packet_id,
CompletionToken && token = as::default_completion_token_t< executor_type >{} )

register packet_id.

Parameters
packet_idpacket_id to register
token
  • CompletionToken
    • Signature: void(error_code)
    • success if packet is acquired, otherwise packet_identifier_fully_used
Returns
deduced by token
Per-Operation Cancellation

This asynchronous operation supports cancellation for the following boost::asio::cancellation_type values:

  • cancellation_type::terminal
  • cancellation_type::partial
  • cancellation_type::total

◆ async_regulate_for_store()

template<role Role, std::size_t PacketIdBytes, typename NextLayer >
template<typename CompletionToken = as::default_completion_token_t<executor_type>>
async_mqtt::basic_endpoint< Role, PacketIdBytes, NextLayer >::async_regulate_for_store ( v5::basic_publish_packet< PacketIdBytes > packet,
CompletionToken && token = as::default_completion_token_t< executor_type >{} )

regulate publish packet for store remove topic alias from the packet and extract the topic name

Parameters
packettarget packet to regulate
token
  • CompletionToken
    • Signature: void(error_code, v5::basic_publish_packet<PacketIdBytes>)
Returns
deduced by token
Per-Operation Cancellation

This asynchronous operation supports cancellation for the following boost::asio::cancellation_type values:

  • cancellation_type::terminal
  • cancellation_type::partial
  • cancellation_type::total

◆ async_release_packet_id()

template<role Role, std::size_t PacketIdBytes, typename NextLayer >
template<typename CompletionToken = as::default_completion_token_t<executor_type>>
async_mqtt::basic_endpoint< Role, PacketIdBytes, NextLayer >::async_release_packet_id ( typename basic_packet_id_type< PacketIdBytes >::type packet_id,
CompletionToken && token = as::default_completion_token_t< executor_type >{} )

release packet_id.

Parameters
packet_idpacket_id to release
token
  • CompletionToken
    • Signature: void()
Returns
deduced by token
Per-Operation Cancellation

This asynchronous operation supports cancellation for the following boost::asio::cancellation_type values:

  • cancellation_type::terminal
  • cancellation_type::partial
  • cancellation_type::total

◆ async_restore_packets()

template<role Role, std::size_t PacketIdBytes, typename NextLayer >
template<typename CompletionToken = as::default_completion_token_t<executor_type>>
async_mqtt::basic_endpoint< Role, PacketIdBytes, NextLayer >::async_restore_packets ( std::vector< basic_store_packet_variant< PacketIdBytes > > pvs,
CompletionToken && token = as::default_completion_token_t< executor_type >{} )

restore packets the restored packets would automatically send when CONNACK packet is received

Parameters
pvspackets to restore
token
  • CompletionToken
    • Signature: void()
Returns
deduced by token
Per-Operation Cancellation

This asynchronous operation supports cancellation for the following boost::asio::cancellation_type values:

  • cancellation_type::terminal
  • cancellation_type::partial
  • cancellation_type::total

◆ async_send()

template<role Role, std::size_t PacketIdBytes, typename NextLayer >
template<typename Packet , typename CompletionToken = as::default_completion_token_t<executor_type>>
async_mqtt::basic_endpoint< Role, PacketIdBytes, NextLayer >::async_send ( Packet packet,
CompletionToken && token = as::default_completion_token_t< executor_type >{} )

send packet users can call send() before the previous send()'s CompletionToken is invoked

Parameters
packetpacket to send
token
  • CompletionToken
    • Signature: void(error_code)
Returns
deduced by token
Per-Operation Cancellation

This asynchronous operation supports cancellation for the following boost::asio::cancellation_type values:

  • cancellation_type::terminal
  • cancellation_type::partial

if they are also supported by the NextLayer type's async_write_some operation.

◆ get_executor()

template<role Role, std::size_t PacketIdBytes, typename NextLayer >
as::any_io_executor async_mqtt::basic_endpoint< Role, PacketIdBytes, NextLayer >::get_executor ( )

executor getter

Returns
return internal stream's executor

◆ get_protocol_version()

template<role Role, std::size_t PacketIdBytes, typename NextLayer >
protocol_version async_mqtt::basic_endpoint< Role, PacketIdBytes, NextLayer >::get_protocol_version ( ) const

get MQTT protocol version

Returns
MQTT protocol version

◆ get_qos2_publish_handled_pids()

template<role Role, std::size_t PacketIdBytes, typename NextLayer >
std::set< typename basic_packet_id_type< PacketIdBytes >::type > async_mqtt::basic_endpoint< Role, PacketIdBytes, NextLayer >::get_qos2_publish_handled_pids ( ) const

Get processed but not released QoS2 packet ids This function should be called after disconnection.

Returns
set of packet_ids

◆ get_stored_packets()

template<role Role, std::size_t PacketIdBytes, typename NextLayer >
std::vector< basic_store_packet_variant< PacketIdBytes > > async_mqtt::basic_endpoint< Role, PacketIdBytes, NextLayer >::get_stored_packets ( ) const

get stored packets sotred packets mean inflight packets.

  • PUBLISH packet (QoS1) not received PUBACK packet
  • PUBLISH packet (QoS1) not received PUBREC packet
  • PUBREL packet not received PUBCOMP packet
    Returns
    std::vector<basic_store_packet_variant<PacketIdBytes>>

◆ is_publish_processing()

template<role Role, std::size_t PacketIdBytes, typename NextLayer >
bool async_mqtt::basic_endpoint< Role, PacketIdBytes, NextLayer >::is_publish_processing ( typename basic_packet_id_type< PacketIdBytes >::type pid) const

Get MQTT PUBLISH packet processing status.

Parameters
pidpacket_id corresponding to the publish packet.
Returns
If the packet is processing, then true, otherwise false.

◆ lowest_layer() [1/2]

template<role Role, std::size_t PacketIdBytes, typename NextLayer >
lowest_layer_type & async_mqtt::basic_endpoint< Role, PacketIdBytes, NextLayer >::lowest_layer ( )

lowest_layer getter

Returns
reference of the lowest_layer

◆ lowest_layer() [2/2]

template<role Role, std::size_t PacketIdBytes, typename NextLayer >
lowest_layer_type const & async_mqtt::basic_endpoint< Role, PacketIdBytes, NextLayer >::lowest_layer ( ) const

lowest_layer getter

Returns
const reference of the lowest_layer

◆ next_layer() [1/2]

template<role Role, std::size_t PacketIdBytes, typename NextLayer >
next_layer_type & async_mqtt::basic_endpoint< Role, PacketIdBytes, NextLayer >::next_layer ( )

next_layer getter

Returns
reference of the next_layer

◆ next_layer() [2/2]

template<role Role, std::size_t PacketIdBytes, typename NextLayer >
next_layer_type const & async_mqtt::basic_endpoint< Role, PacketIdBytes, NextLayer >::next_layer ( ) const

next_layer getter

Returns
const reference of the next_layer

◆ register_packet_id()

template<role Role, std::size_t PacketIdBytes, typename NextLayer >
bool async_mqtt::basic_endpoint< Role, PacketIdBytes, NextLayer >::register_packet_id ( typename basic_packet_id_type< PacketIdBytes >::type packet_id)

register packet_id.

Parameters
packet_idpacket_id to register
Returns
If true, success, otherwise the packet_id has already been used.

◆ regulate_for_store()

template<role Role, std::size_t PacketIdBytes, typename NextLayer >
void async_mqtt::basic_endpoint< Role, PacketIdBytes, NextLayer >::regulate_for_store ( v5::basic_publish_packet< PacketIdBytes > & packet,
error_code & ec ) const

Regulate publish packet for store If topic is empty, extract topic from topic alias, and remove topic alias Otherwise, remove topic alias if exists.

Parameters
packetpacket to regulate
ecerror_code for repoting error

◆ release_packet_id()

template<role Role, std::size_t PacketIdBytes, typename NextLayer >
void async_mqtt::basic_endpoint< Role, PacketIdBytes, NextLayer >::release_packet_id ( typename basic_packet_id_type< PacketIdBytes >::type packet_id)

release packet_id.

Parameters
packet_idpacket_id to release

◆ restore_packets()

template<role Role, std::size_t PacketIdBytes, typename NextLayer >
void async_mqtt::basic_endpoint< Role, PacketIdBytes, NextLayer >::restore_packets ( std::vector< basic_store_packet_variant< PacketIdBytes > > pvs)

restore packets the restored packets would automatically send when CONNACK packet is received

Parameters
pvspackets to restore

◆ restore_qos2_publish_handled_pids()

template<role Role, std::size_t PacketIdBytes, typename NextLayer >
void async_mqtt::basic_endpoint< Role, PacketIdBytes, NextLayer >::restore_qos2_publish_handled_pids ( std::set< typename basic_packet_id_type< PacketIdBytes >::type > pids)

Restore processed but not released QoS2 packet ids This function should be called before receive the first publish.

Parameters
pidspacket ids

◆ set_auto_map_topic_alias_send()

template<role Role, std::size_t PacketIdBytes, typename NextLayer >
void async_mqtt::basic_endpoint< Role, PacketIdBytes, NextLayer >::set_auto_map_topic_alias_send ( bool val)

auto map (allocate) topic alias on send PUBLISH packet. If all topic aliases are used, then overwrite by LRU algorithm.
This function should be called before send() call.

Note
By default not automatically mapping.
Parameters
valif true, enable auto mapping, otherwise disable.

◆ set_auto_ping_response()

template<role Role, std::size_t PacketIdBytes, typename NextLayer >
void async_mqtt::basic_endpoint< Role, PacketIdBytes, NextLayer >::set_auto_ping_response ( bool val)

auto pingreq response setter. Should be called before send()/recv() call.

Note
By default not automatically sending.
Parameters
valif true, puback, pubrec, pubrel, and pubcomp are automatically sent

◆ set_auto_pub_response()

template<role Role, std::size_t PacketIdBytes, typename NextLayer >
void async_mqtt::basic_endpoint< Role, PacketIdBytes, NextLayer >::set_auto_pub_response ( bool val)

auto publish response setter. Should be called before send()/recv() call.

Note
By default not automatically sending.
Parameters
valif true, puback, pubrec, pubrel, and pubcomp are automatically sent

◆ set_auto_replace_topic_alias_send()

template<role Role, std::size_t PacketIdBytes, typename NextLayer >
void async_mqtt::basic_endpoint< Role, PacketIdBytes, NextLayer >::set_auto_replace_topic_alias_send ( bool val)

auto replace topic with corresponding topic alias on send PUBLISH packet. Registering topic alias need to do manually.
This function should be called before send() call.

Note
By default not automatically replacing.
Parameters
valif true, enable auto replacing, otherwise disable.

◆ set_bulk_read_buffer_size()

template<role Role, std::size_t PacketIdBytes, typename NextLayer >
void async_mqtt::basic_endpoint< Role, PacketIdBytes, NextLayer >::set_bulk_read_buffer_size ( std::size_t val)

Set the bulk read buffer size. If bulk read is enabled, the val parameter specifies the size of the internal async_read_some() buffer. Enabling bulk read can improve throughput but may increase latency. Disabling bulk read can reduce latency but may lower throughput. By default, bulk read is disabled.

Parameters
valIf set to 0, bulk read is disabled. Otherwise, it specifies the buffer size.

◆ set_bulk_write()

template<role Role, std::size_t PacketIdBytes, typename NextLayer >
void async_mqtt::basic_endpoint< Role, PacketIdBytes, NextLayer >::set_bulk_write ( bool val)

Set bulk write mode. If true, then concatenate multiple packets' const buffer sequence when send() is called before the previous send() is not completed. Otherwise, send packet one by one.
This function should be called before send() call.

Note
By default bulk write mode is false (disabled)
Parameters
valif true, enable bulk write mode, otherwise disable it.

◆ set_pingreq_send_interval()

template<role Role, std::size_t PacketIdBytes, typename NextLayer >
void async_mqtt::basic_endpoint< Role, PacketIdBytes, NextLayer >::set_pingreq_send_interval ( std::chrono::milliseconds duration)

Set PINGREQ packet sending interval.

Note
By default, PINGREQ packet sending interval is set the same value as CONNECT packet keep alive seconds. This function overrides it.
Parameters
durationif zero, timer is not set; otherwise duration is set. The minimum resolution is in milliseconds.

◆ set_pingresp_recv_timeout()

template<role Role, std::size_t PacketIdBytes, typename NextLayer >
void async_mqtt::basic_endpoint< Role, PacketIdBytes, NextLayer >::set_pingresp_recv_timeout ( std::chrono::milliseconds duration)

Set timeout for receiving PINGRESP packet after PINGREQ packet is sent. If the timer is fired, then the underlying layer is closed from the client side. If the protocol_version is v5, then send DISCONNECT packet with the reason code disconnect_reason_code::keep_alive_timeout automatically before underlying layer is closed.
This function should be called before send() call.

Note
By default timeout is not set.
Parameters
durationif zero, timer is not set; otherwise duration is set. The minimum resolution is in milliseconds.

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