Module cloudmqtt::server

source ·
Expand description

MQTTServer and internals

Server Architecture

The server consists of multiple parts:

  • An [MQTTServer], the main part of the whole and the user-visible part
  • The [SubscriptionManager] which maintains subscription state

Per MQTT Spec in 3.1.2.4 the server has to keep the following state:

  • Whether a session exists -> [ClientSession]
  • The clients subscriptions -> [SubscriptionManager]

This implementation utilizes “Method B” for QoS 2 protocol flow, as explained in Figure 4.3 of the MQTT Spec. This minimizes data being held in the application.

  • QoS 1 & 2 messages which have been relayed to the client, but not yet acknowledged
  • QoS 0 & 1 & 2 messages pending transmission
  • QoS 2 messages which have been received from the client, but have not been acknowledged

Modules

Authentication related functionality

Structs

The unique id (per server) of a connecting client
A complete MQTT Server

Enums

An error that occurred while communicating with a client