LavinMQ::MQTT::Broker
Constants
Log = LavinMQ::Log.for("mqtt.broker")
Constructors
new(vhost : VHost)
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.
Instance methods
add_client(io, connection_info, user, packet) : Client
Sourceclose
SourceA reconnecting client_id displaces the existing connection in
add_client, so the connection count doesn't grow
grant(session : Session, tf) : Protocol::SubAck::ReturnCode
Sourcepermission_service
SourceReturns false, without storing or routing the packet, during a disk alarm
remove_client(client)
Sourcerun_client(io, connection_info, user, packet) : Client
Sourcesessions
Sourceunsubscribe(client_id, topics)
Sourcevhost
Source