11255c6602
Motivation: Currently, the only way to create fixed-header only messages PINGREQ, PINGRESP and DISCONNECT is to explicitly instantiate a `MqttFixedHeader` like: ``` MqttFixedHeader disconnectFixedHeader = new MqttFixedHeader(MqttMessageType.DISCONNECT, false, MqttQoS.AT_MOST_ONCE, false, 0); MqttMessage disconnectMessage = new MqttMessage(disconnectFixedHeader); ``` According to the MQTT spec (http://docs.oasis-open.org/mqtt/mqtt/v3.1.1/os/mqtt-v3.1.1-os.html#_Toc398718077), the fixed-header flags for these messages are reserved and must be set to zero, otherwise the receiver must close the connection. It's easy to mess this up when you're creating the header explicitly, for e.g by setting the QoS bit to `AT_LEAST_ONCE`. As such, provide static constants for PINGREQ, PINGRESP and DISCONNECT messages that will set the flags correctly for the developer. Modification: Add static constants to MqttMessage class to construct PINGREQ, PINGRESP and DISCONNECT messages that will set the fixed-header flags correctly to 0. Result: Easier usage. |
||
---|---|---|
.. | ||
src | ||
pom.xml |