Discussion:
MQTT CONNECT parsing in Lua
Baptiste
2018-12-11 02:29:50 UTC
Permalink
Hi guys,

At last AWS conference, I met with a engineer who was using HAProxy to
load-balance IoT devices through HAProxy using MQTT protocol and he was
complaining about the poor performance of the server with 10k of devices
just get reconnecting.
He pointed SSL performance but also authentication (validation of username
/ password).

So I wrote a small MQTT library for HAProxy which allows parsing the MQTT
CONNECT message, the very first one being sent by a client.
The library allows the following:
* validation of the message (through a converter)
* fetch any field from the connect message (client id, username, password,
etc...) for fun and profit (routing, persistence, rate or concurrent
connection enforcement, etc...)
* write your own authentication validation module on top of HAProxy

The code is there, including some HAProxy configuration examples:
https://github.com/bedis/haproxy_mqtt_lua

I hope this will be useful to some of you.
I am planning to write in native C the converter and the fetch above.

Baptiste

Loading...