After about a month of work during my free time, it's finally time to release the new version of the M2Mqtt library ( and the related GnatMQ broker ( Beta) with the MQTT OASIS 3.1.1 specification support (in addition to some bug fixes).


This was the cause of my absence on the blog !


The changes made to the overall project are the following :


  • Support for old 3.1.0 and new OASIS 3.1.1 specification;
  • MqttMsgDisconnected event is exposed only to the GnatMQ broker to handle DISCONNECT message from a client. ConnectionClosed event was added and it is raised when the connection is closed by the client itself or by the peer. It's a breaking change, I'm apologize but MqttMsgDisconnected didn't make sense for client disconnection but only for DISCONNECT message received;

  • Added session management (however without persistence) for supporting for 3.1.1 specification (subscription and enqueued messages with QoS 1 and 2);

  • Keep Alive ping request disabled if keep alive timeout is set to zero;

  • GnatMQ handles “session present” flag that is set into CONNACK message for the client if there is an old session restored. In this way the client knows that the broker has restored his previous session. Of course, this flag is handled by M2Mqtt client;

  • Zero bytes client identifier allowed. In this case the GnatMQ assigns a random client identifier to the client. Of course, in this case the session can't be managed because the client doesn't know the client identifier assigned by the broker that can't recover session after a client reconnection (anonymous MQTT client);

  • Removed 23 characters length on client identifier;

  • Now you can set “inflight queue” size to avoid enqueue other messages to publish if the inflight queue is already full (due to network problems);

  • Improvements on receiving thread with some modification on underlying network channel;

  • On subscription request for a topic, the client can receive an error on SUBACK message because the broker rejects the request (forbidden subscription);


As always, I updated all repositories for my project :



This can be considered my Christmas gift !