Skip to content

add support for MQTT 5 #174

@ajmirsky

Description

@ajmirsky

Overview

while MQTT 3 support for clients still remains, MQTT 5 was released in 2019 and support across other broker and clients has steadily increased.

with aMQTT's structure, there are lots of details to implement but the framework is modular enough to support this change.

Architecture Proposal

the biggest challenge (i believe) is just the module and/or class renaming that needs to happen to allow a distinct namespace for MQTT5 from MQTT3.1.1

the first (i think) is preferable over the second but there are two options:

  • the existing mqtt module with packet definitions gets renamed mqtt3
  • keep mqtt3 and mqtt5 packet types in the same files and rename 'ConnackPackettoConnackPacketV3`

the only example that i know of where multiple protocol versions are supported simultaneously is the OCPP library which uses the first structure.

broker & client protocol handlers will need to be renamed too. as well as a few other things.

if broker and client protocol handlers are separate, it won't be a common case, but if both mqtt3 and mqtt5 packet types are needed to be imported into the same file, use this convention:

from amqtt.mqtt3 import connect as connect3
from amqtt.mqtt5 import connect as connect5

connect_3_packet = connect3.ConnectPacket(...)
connect_5_packet = connect5.ConnectPacket(...)

Roadmap

Multi-phase approach:

  • 0.11.4 : rename only: mqtt package to mqtt3 and broker/client handler files, make sure all tests still pass
  • 0.11.5 : implement mqtt5 client only, using another broker as reference
  • 0.12.0: implement mqtt5 broker and leverage the amqtt (and other mqtt) clients as reference for testing

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions