mqtt_cpp
Public Member Functions | List of all members
broker_t Class Reference

#include <broker.hpp>

Public Member Functions

 broker_t (as::io_context &ioc)
 
void set_disconnect_delay (std::chrono::steady_clock::duration delay)
 set_disconnect_delay adds a delay to disconnect operations. More...
 
void set_pingresp (bool b)
 set pingresp send operaton More...
 
void handle_accept (con_sp_t spep)
 handle_accept More...
 
void set_connack_props (v5::properties props)
 
void set_suback_props (v5::properties props)
 
void set_unsuback_props (v5::properties props)
 
void set_puback_props (v5::properties props)
 
void set_pubrec_props (v5::properties props)
 
void set_pubrel_props (v5::properties props)
 
void set_pubcomp_props (v5::properties props)
 
void set_connect_props_handler (std::function< void(v5::properties const &)> h)
 
void set_disconnect_props_handler (std::function< void(v5::properties const &)> h)
 
void set_publish_props_handler (std::function< void(v5::properties const &)> h)
 
void set_puback_props_handler (std::function< void(v5::properties const &)> h)
 
void set_pubrec_props_handler (std::function< void(v5::properties const &)> h)
 
void set_pubrel_props_handler (std::function< void(v5::properties const &)> h)
 
void set_pubcomp_props_handler (std::function< void(v5::properties const &)> h)
 
void set_subscribe_props_handler (std::function< void(v5::properties const &)> h)
 
void set_unsubscribe_props_handler (std::function< void(v5::properties const &)> h)
 
void set_auth_props_handler (std::function< void(v5::properties const &)> h)
 
void clear_all_sessions ()
 
void clear_all_retained_topics ()
 

Constructor & Destructor Documentation

◆ broker_t()

broker_t::broker_t ( as::io_context &  ioc)
inline

Member Function Documentation

◆ clear_all_retained_topics()

void broker_t::clear_all_retained_topics ( )
inline

◆ clear_all_sessions()

void broker_t::clear_all_sessions ( )
inline

◆ handle_accept()

void broker_t::handle_accept ( con_sp_t  spep)
inline

handle_accept

Call this function when an server (of whatever kind) has accepted a raw connection from an MQTT client. By 'raw connection', this might be raw TCP sockets or websockets, or completed a TLS handshake, or any other underlying transport type, but what is not meant is that the mqtt client on the other end of the endpoint has initiated the MQTT application protocol connection sequence with CONNECT or CONACK messages being sent or received.

This function will assign several event handlers into server (of whatever kind) that is provided as a parameter. This includes connection handlers, disconnection handlers and various handlers for a variety of of MQTT message types.

Parameters
ep- The server (of whichever kind) to accept a connection on.

◆ set_auth_props_handler()

void broker_t::set_auth_props_handler ( std::function< void(v5::properties const &)>  h)
inline

◆ set_connack_props()

void broker_t::set_connack_props ( v5::properties  props)
inline

◆ set_connect_props_handler()

void broker_t::set_connect_props_handler ( std::function< void(v5::properties const &)>  h)
inline

◆ set_disconnect_delay()

void broker_t::set_disconnect_delay ( std::chrono::steady_clock::duration  delay)
inline

set_disconnect_delay adds a delay to disconnect operations.

This makes the broker wait the specified amount between when a disconnect is received from a client, and when the connection is actually closed in the broker.

Parameters
delay- the amount to delay by

◆ set_disconnect_props_handler()

void broker_t::set_disconnect_props_handler ( std::function< void(v5::properties const &)>  h)
inline

◆ set_pingresp()

void broker_t::set_pingresp ( bool  b)
inline

set pingresp send operaton

Parameters
b- if true, send pingresp when pingreq is received. if false, doesn't send pingrespp for test.

◆ set_puback_props()

void broker_t::set_puback_props ( v5::properties  props)
inline

◆ set_puback_props_handler()

void broker_t::set_puback_props_handler ( std::function< void(v5::properties const &)>  h)
inline

◆ set_pubcomp_props()

void broker_t::set_pubcomp_props ( v5::properties  props)
inline

◆ set_pubcomp_props_handler()

void broker_t::set_pubcomp_props_handler ( std::function< void(v5::properties const &)>  h)
inline

◆ set_publish_props_handler()

void broker_t::set_publish_props_handler ( std::function< void(v5::properties const &)>  h)
inline

◆ set_pubrec_props()

void broker_t::set_pubrec_props ( v5::properties  props)
inline

◆ set_pubrec_props_handler()

void broker_t::set_pubrec_props_handler ( std::function< void(v5::properties const &)>  h)
inline

◆ set_pubrel_props()

void broker_t::set_pubrel_props ( v5::properties  props)
inline

◆ set_pubrel_props_handler()

void broker_t::set_pubrel_props_handler ( std::function< void(v5::properties const &)>  h)
inline

◆ set_suback_props()

void broker_t::set_suback_props ( v5::properties  props)
inline

◆ set_subscribe_props_handler()

void broker_t::set_subscribe_props_handler ( std::function< void(v5::properties const &)>  h)
inline

◆ set_unsuback_props()

void broker_t::set_unsuback_props ( v5::properties  props)
inline

◆ set_unsubscribe_props_handler()

void broker_t::set_unsubscribe_props_handler ( std::function< void(v5::properties const &)>  h)
inline

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