sozu icon indicating copy to clipboard operation
sozu copied to clipboard

MQTT support

Open NotBad4U opened this issue 7 years ago • 0 comments

Presentation of MQTT

MQTT (Message Queuing Telemetry Transport) is an publish-subscribe-based messaging protocol. An MQTT system consists of clients communicating with a server, called a broker. A client may be either a publisher of information or a subscriber. Each client can connect to the broker.

Network/Transport layer details

The transport protocol used to carry MQTT 3.1 was TCP/IP. The following are also suitable:

  • TLS
  • WebSocket

Apparently MQTT v3.1 has username/password support at the API level, so you can ensure only authenticated users connect.

broker

There are a lot of mqtt broker implementation e.g.:

The protocol in brief

topics

Topics on a broker are always expected to be "dynamic" and to require no administrative setup.They are arbitrary strings separate by '/' to form an hierarchy (like unix path). A subscriber can use a wildcard when he want to to subscribe to N topics:

a subscription to A/# is a subscription to the topic A and all topics beneath A
a subscription to A/+ is a subscription to the topics directly beneath, but not A itself
a subscription to A/+/# is a subscription to all topics beneath A, but not A itself

Quality of service (QOS)

MQTT delivers messages according to the levels defined in a Quality of Service (QoS). The levels are described below:

  • 0 = At most once delivery
  • 1 = At least once delivery
  • 2 = Exactly once delivery

Message

The messaging transport is agnostic to the content of the payload (binary, text, ...).

First thoughts: to support MQTT in sozu

  • Sozu could be a reverse proxy for multiples mqtt broker.
  • The proxy should keep the payload of message unparsed.
  • A topic could be an application but the application type in Sozu doesn't have the notion of sub application (for sub topic).
  • The support of QOS can be not needed because this impact the connection between the broker and subscribers.
  • The SSL/TLS support could be done with by reusing the jobs done with rust_tls|rust_openssl ? (Maybe that need a little refactoring)
  • Workers should be able to create a dynamic topic (application) when they discover a new one (Topics on a broker are always expected to be "dynamic") and prevent the master and other works of their creation.

docs:

NotBad4U avatar Nov 21 '18 17:11 NotBad4U