class LavinMQ::MQTT::Broker

Defined in:

lavinmq/mqtt/broker.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(vhost : VHost, replicator : Clustering::Replicator) #

The Broker class acts as an intermediary between the Server and MQTT connections. It is initialized by the Server and manages client connections, sessions, and message exchange. Responsibilities include:

  • Handling client connections and disconnections
  • Managing client sessions (clean and persistent)
  • Publishing messages to the exchange
  • Subscribing and unsubscribing clients to/from topics
  • Handling the retain store
  • Interfacing with the virtual host (vhost) and the exchange to route messages The Broker class helps keep the MQTT client concise and focused on the protocol.

[View source]

Instance Method Detail

def add_client(socket, connection_info, user, packet) #

[View source]
def close #

[View source]
def publish(packet : MQTT::Publish) #

[View source]
def remove_client(client) #

[View source]
def session_present?(client_id : String, clean_session) : Bool #

[View source]
def sessions : LavinMQ::MQTT::Sessions #

[View source]
def subscribe(client, topics) #

[View source]
def unsubscribe(client_id, topics) #

[View source]
def vhost : LavinMQ::VHost #

[View source]