class
LavinMQ::MQTT::Broker
- LavinMQ::MQTT::Broker
- Reference
- Object
Defined in:
lavinmq/mqtt/broker.crConstructors
Instance Method Summary
- #add_client(socket, connection_info, user, packet)
- #close
- #publish(packet : MQTT::Publish)
- #remove_client(client)
- #session_present?(client_id : String, clean_session) : Bool
- #sessions : LavinMQ::MQTT::Sessions
- #subscribe(client, topics)
- #unsubscribe(client_id, topics)
- #vhost : LavinMQ::VHost
Constructor Detail
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
Brokerclass helps keep the MQTT client concise and focused on the protocol.