The Erlang code looks very nice. If you read this, great work Patrick!
https://bitbucket.org/pvalsecc/
Nice use of gen_fsm + binary matching.
Here is an example of the client code that takes only 200 lines:
https://bitbucket.org/pvalsecc/erlangmqtt/src/f37505188c1f1c...
Umbrella Project can be found on https://github.com/erlio/vernemq as well as our website https://verne.mq