-
Type:
Improvement
-
Status:
Closed
-
Priority:
Major
-
Resolution:
Fixed
-
Affects Version/s:
3.1.1
-
-
-
-
Proposal:
Hide
463 (Description of Connect Message) and 614 (Payload). Change "The payload contains one or more UTF-8 encoded strings" to "The payload contains one ore more encoded fields"
615 Change "These strings, if present.." to "These fields, if present.."
Each of 620 / 637 / 649 / 661 (Client ID, Will Topic, User Name, Password) change "UTF-encoded string" to "field", and add a further sentence saying "It is a UTF-8 encoded string".
641..643 Change the paragraph
"If the Will Flag=1, this is the next UTF-8 encoded string. The Will Message defines the content of the message that is published to the Will Topic if the client is unexpectedly disconnected. The Will Message can contain zero characters."
to say
"If the Will Flag=1, this is the next encoded field. The Will Message defines the payload content of the message that is published to the Will Topic if the client is unexpectedly disconnected. This field, if present, must consist of a 2-byte length (MSB followed by LSB) followed by the payload for the Will Message expressed as a sequence of zero or more bytes. The length gives the number of bytes in the payload that follows and does not include the 2 bytes taken up by the length itself."
645...647 Change the paragraph
"Although the Will Message is UTF-8 encoded in the CONNECT message, when it is published to the Will Topic only the bytes of the message are sent, not the first two length bytes. The message must therefore only consist of 7-bit ASCII characters."
to say
"When the Will Message is published to the Will Topic its payload consists only of the payload portion of this field, not the first two length bytes"
Show
463 (Description of Connect Message) and 614 (Payload). Change "The payload contains one or more UTF-8 encoded strings" to "The payload contains one ore more encoded fields"
615 Change "These strings, if present.." to "These fields, if present.."
Each of 620 / 637 / 649 / 661 (Client ID, Will Topic, User Name, Password) change "UTF-encoded string" to "field", and add a further sentence saying "It is a UTF-8 encoded string".
641..643 Change the paragraph
"If the Will Flag=1, this is the next UTF-8 encoded string. The Will Message defines the content of the message that is published to the Will Topic if the client is unexpectedly disconnected. The Will Message can contain zero characters."
to say
"If the Will Flag=1, this is the next encoded field. The Will Message defines the payload content of the message that is published to the Will Topic if the client is unexpectedly disconnected. This field, if present, must consist of a 2-byte length (MSB followed by LSB) followed by the payload for the Will Message expressed as a sequence of zero or more bytes. The length gives the number of bytes in the payload that follows and does not include the 2 bytes taken up by the length itself."
645...647 Change the paragraph
"Although the Will Message is UTF-8 encoded in the CONNECT message, when it is published to the Will Topic only the bytes of the message are sent, not the first two length bytes. The message must therefore only consist of 7-bit ASCII characters."
to say
"When the Will Message is published to the Will Topic its payload consists only of the payload portion of this field, not the first two length bytes"
The current 3.1 specification states that the will message is encoded in UTF-8 in the CONNECT message but will be published in ASCII encoding by a MQTT broker. This is a major inconsistency in the specification since this is the only case where ASCII encoding is used.
Here's the relevant citation from the specification:
"Although the Will Message is UTF-8 encoded in the CONNECT message, when it is published to the Will Topic only the bytes of the message are sent, not the first two length bytes. The message must therefore only consist of 7-bit ASCII characters."
A payload for a PUBLISH can of course be any raw bytes, in case of the will message we should think of removing the inconsistency from the spec. I see two possibilities:
1. The will message in the CONNECT message is not UTF-8 encoded but ASCII encoded.
2. The will message in the will PUBLISH is UTF-8. This would collide with the current spec because empty payloads are possible regarding to the 3.1 spec (in case of UTF-8 IIRC two length bytes have to be sent even with an empty message).
I would vote for option two because this would remove this inconsistency in the spec and the will message is encoded in the CONNECT message in UTF-8 anyway. I don't think the overhead of the two length bytes in case of an empty message are a serious problem. We could discuss if it would be reasonable that in case of an empty payload (= empty UTF-8 String) the length bytes should be removed automatically by broker implementations to reduce the overhead in PUBLISH messages.
{"report":{"apdex":1,"isInitial":true,"journeyId":"8161bf03-64bf-4410-bb5a-e1ff212f92f8","key":"jira.project.issue.view-issue","navigationType":0,"readyForUser":728.8999996185303,"redirectCount":0,"resourceLoadedEnd":717.5999999046326,"resourceLoadedStart":239.09999990463257,"resourceTiming":[{"duration":98.5,"initiatorType":"link","name":"https://issues.oasis-open.org/s/3edeca31ab9ba77980aae0809fbe7121-CDN/nu8zej/803004/aeedb5937bed650f2f0cc4ec9ceaa5d3/0a4716d29b2d5b1bdcdb168b4efc119e/_/download/contextbatch/css/_super/batch.css","startTime":239.09999990463257,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":239.09999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":337.59999990463257,"responseStart":0,"secureConnectionStart":0},{"duration":98.2999997138977,"initiatorType":"link","name":"https://issues.oasis-open.org/s/7d2823769c2e7b66e860863fe879b7f8-CDN/nu8zej/803004/aeedb5937bed650f2f0cc4ec9ceaa5d3/9aebb1c0aaa4c36289529757ec9dbb54/_/download/contextbatch/css/project.issue.navigator,jira.view.issue,jira.global,atl.general,-_super/batch.css?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&richediton=true","startTime":239.5,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":239.5,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":337.7999997138977,"responseStart":0,"secureConnectionStart":0},{"duration":98.30000019073486,"initiatorType":"link","name":"https://issues.oasis-open.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/nu8zej/803004/aeedb5937bed650f2f0cc4ec9ceaa5d3/8.0.5/_/download/batch/com.atlassian.auiplugin:split_aui.pattern.label/com.atlassian.auiplugin:split_aui.pattern.label.css","startTime":239.69999980926514,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":239.69999980926514,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":338,"responseStart":0,"secureConnectionStart":0},{"duration":98.40000009536743,"initiatorType":"link","name":"https://issues.oasis-open.org/s/645acc233eb869f48a571293b8358a7d-CDN/nu8zej/803004/aeedb5937bed650f2f0cc4ec9ceaa5d3/1.0/_/download/batch/jira.webresources:global-static-adgs/jira.webresources:global-static-adgs.css","startTime":239.7999997138977,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":239.7999997138977,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":338.19999980926514,"responseStart":0,"secureConnectionStart":0},{"duration":98.19999980926514,"initiatorType":"link","name":"https://issues.oasis-open.org/s/a0dd6509771c1de0667aae5429c04cda-CDN/nu8zej/803004/aeedb5937bed650f2f0cc4ec9ceaa5d3/1.0/_/download/batch/jira.webresources:global-static/jira.webresources:global-static.css","startTime":240,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":240,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":338.19999980926514,"responseStart":0,"secureConnectionStart":0},{"duration":141.59999990463257,"initiatorType":"script","name":"https://issues.oasis-open.org/s/e5479157e7a0c08b005e6522f2f04104-CDN/nu8zej/803004/aeedb5937bed650f2f0cc4ec9ceaa5d3/0a4716d29b2d5b1bdcdb168b4efc119e/_/download/contextbatch/js/_super/batch.js?locale=en-US","startTime":240.2999997138977,"connectEnd":240.2999997138977,"connectStart":240.2999997138977,"domainLookupEnd":240.2999997138977,"domainLookupStart":240.2999997138977,"fetchStart":240.2999997138977,"redirectEnd":0,"redirectStart":0,"requestStart":240.2999997138977,"responseEnd":381.8999996185303,"responseStart":381.8999996185303,"secureConnectionStart":240.2999997138977},{"duration":161.7000002861023,"initiatorType":"script","name":"https://issues.oasis-open.org/s/83514d5d4e8543747b02042eafcdc99c-CDN/nu8zej/803004/aeedb5937bed650f2f0cc4ec9ceaa5d3/9aebb1c0aaa4c36289529757ec9dbb54/_/download/contextbatch/js/project.issue.navigator,jira.view.issue,jira.global,atl.general,-_super/batch.js?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&locale=en-US&richediton=true","startTime":240.89999961853027,"connectEnd":240.89999961853027,"connectStart":240.89999961853027,"domainLookupEnd":240.89999961853027,"domainLookupStart":240.89999961853027,"fetchStart":240.89999961853027,"redirectEnd":0,"redirectStart":0,"requestStart":240.89999961853027,"responseEnd":402.59999990463257,"responseStart":402.59999990463257,"secureConnectionStart":240.89999961853027},{"duration":164,"initiatorType":"script","name":"https://issues.oasis-open.org/s/70bb2263e59e7e1f04fbd137c80b895b-CDN/nu8zej/803004/aeedb5937bed650f2f0cc4ec9ceaa5d3/aae1242f5fc81cc6a5bb8bc963ccda29/_/download/contextbatch/js/atl.global,-_super/batch.js?locale=en-US","startTime":241,"connectEnd":241,"connectStart":241,"domainLookupEnd":241,"domainLookupStart":241,"fetchStart":241,"redirectEnd":0,"redirectStart":0,"requestStart":241,"responseEnd":405,"responseStart":405,"secureConnectionStart":241},{"duration":164.19999980926514,"initiatorType":"script","name":"https://issues.oasis-open.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/nu8zej/803004/aeedb5937bed650f2f0cc4ec9ceaa5d3/1.0/_/download/batch/jira.webresources:calendar-en/jira.webresources:calendar-en.js","startTime":241.19999980926514,"connectEnd":241.19999980926514,"connectStart":241.19999980926514,"domainLookupEnd":241.19999980926514,"domainLookupStart":241.19999980926514,"fetchStart":241.19999980926514,"redirectEnd":0,"redirectStart":0,"requestStart":241.19999980926514,"responseEnd":405.3999996185303,"responseStart":405.3999996185303,"secureConnectionStart":241.19999980926514},{"duration":164.40000009536743,"initiatorType":"script","name":"https://issues.oasis-open.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/nu8zej/803004/aeedb5937bed650f2f0cc4ec9ceaa5d3/1.0/_/download/batch/jira.webresources:calendar-localisation-moment/jira.webresources:calendar-localisation-moment.js","startTime":241.39999961853027,"connectEnd":241.39999961853027,"connectStart":241.39999961853027,"domainLookupEnd":241.39999961853027,"domainLookupStart":241.39999961853027,"fetchStart":241.39999961853027,"redirectEnd":0,"redirectStart":0,"requestStart":241.39999961853027,"responseEnd":405.7999997138977,"responseStart":405.7999997138977,"secureConnectionStart":241.39999961853027},{"duration":164.59999990463257,"initiatorType":"script","name":"https://issues.oasis-open.org/s/cda37faab827dbdf305de8efe8282062-CDN/nu8zej/803004/aeedb5937bed650f2f0cc4ec9ceaa5d3/8.0.5/_/download/batch/com.atlassian.auiplugin:split_aui.pattern.label/com.atlassian.auiplugin:split_aui.pattern.label.js?locale=en-US","startTime":241.59999990463257,"connectEnd":241.59999990463257,"connectStart":241.59999990463257,"domainLookupEnd":241.59999990463257,"domainLookupStart":241.59999990463257,"fetchStart":241.59999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":241.59999990463257,"responseEnd":406.19999980926514,"responseStart":406.19999980926514,"secureConnectionStart":241.59999990463257},{"duration":165,"initiatorType":"link","name":"https://issues.oasis-open.org/s/07245784f53abc49bad9d9d4d36c577a-CDN/nu8zej/803004/aeedb5937bed650f2f0cc4ec9ceaa5d3/cadc4f20cc5c138dee060d42cf85f220/_/download/contextbatch/css/jira.global.look-and-feel,-_super/batch.css","startTime":241.69999980926514,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":241.69999980926514,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":406.69999980926514,"responseStart":0,"secureConnectionStart":0},{"duration":164.7000002861023,"initiatorType":"script","name":"https://issues.oasis-open.org/rest/api/1.0/shortcuts/803004/a29179d70fa8562374ee16707692af77/shortcuts.js?context=issuenavigation&context=issueaction","startTime":241.89999961853027,"connectEnd":241.89999961853027,"connectStart":241.89999961853027,"domainLookupEnd":241.89999961853027,"domainLookupStart":241.89999961853027,"fetchStart":241.89999961853027,"redirectEnd":0,"redirectStart":0,"requestStart":241.89999961853027,"responseEnd":406.59999990463257,"responseStart":406.59999990463257,"secureConnectionStart":241.89999961853027},{"duration":129.90000009536743,"initiatorType":"link","name":"https://issues.oasis-open.org/s/f77fd89aa211a76b20e9b0e63564383c-CDN/nu8zej/803004/aeedb5937bed650f2f0cc4ec9ceaa5d3/4a9288299d147101bf66484f4be48925/_/download/contextbatch/css/com.atlassian.jira.projects.sidebar.init,-_super,-jira.view.issue,-project.issue.navigator/batch.css?jira.create.linked.issue=true&richediton=true","startTime":277.19999980926514,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":277.19999980926514,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":407.09999990463257,"responseStart":0,"secureConnectionStart":0},{"duration":129.69999980926514,"initiatorType":"script","name":"https://issues.oasis-open.org/s/41525c48ddceeb9b11e54085268fc285-CDN/nu8zej/803004/aeedb5937bed650f2f0cc4ec9ceaa5d3/4a9288299d147101bf66484f4be48925/_/download/contextbatch/js/com.atlassian.jira.projects.sidebar.init,-_super,-jira.view.issue,-project.issue.navigator/batch.js?jira.create.linked.issue=true&locale=en-US&richediton=true","startTime":277.5,"connectEnd":277.5,"connectStart":277.5,"domainLookupEnd":277.5,"domainLookupStart":277.5,"fetchStart":277.5,"redirectEnd":0,"redirectStart":0,"requestStart":277.5,"responseEnd":407.19999980926514,"responseStart":407.19999980926514,"secureConnectionStart":277.5},{"duration":429.69999980926514,"initiatorType":"script","name":"https://issues.oasis-open.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/nu8zej/803004/aeedb5937bed650f2f0cc4ec9ceaa5d3/1.0/_/download/batch/jira.webresources:bigpipe-js/jira.webresources:bigpipe-js.js","startTime":287,"connectEnd":287,"connectStart":287,"domainLookupEnd":287,"domainLookupStart":287,"fetchStart":287,"redirectEnd":0,"redirectStart":0,"requestStart":287,"responseEnd":716.6999998092651,"responseStart":716.6999998092651,"secureConnectionStart":287},{"duration":397.5,"initiatorType":"script","name":"https://issues.oasis-open.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/nu8zej/803004/aeedb5937bed650f2f0cc4ec9ceaa5d3/1.0/_/download/batch/jira.webresources:bigpipe-init/jira.webresources:bigpipe-init.js","startTime":320.09999990463257,"connectEnd":320.09999990463257,"connectStart":320.09999990463257,"domainLookupEnd":320.09999990463257,"domainLookupStart":320.09999990463257,"fetchStart":320.09999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":320.09999990463257,"responseEnd":717.5999999046326,"responseStart":717.5999999046326,"secureConnectionStart":320.09999990463257}],"threshold":1000,"fetchStart":0,"domainLookupStart":125,"domainLookupEnd":125,"connectStart":125,"connectEnd":182,"secureConnectionStart":150,"requestStart":182,"responseStart":231,"responseEnd":319,"domLoading":234,"domInteractive":815,"domContentLoadedEventStart":815,"domContentLoadedEventEnd":866,"domComplete":1412,"loadEventStart":1412,"loadEventEnd":1414,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[],"measures":[],"correlationId":"ec47748c7eada7","effectiveType":"4g","downlink":9,"rtt":0,"serverDuration":111,"dbReadsTimeInMs":13,"dbConnsTimeInMs":15,"applicationHash":"4d4040e0714d65b7fffa4801569d014c0b16eaa9","experiments":[]}}
This has been discussed before on the mqtt.org mailing list, and is documented on the wiki: http://mqtt.org/wiki/doku.php/will_message_utf8_support
In summary, the spec is misleading to use terms like 'UTF-8' and ASCII when talking about the encoding of the will message. The will message payload is just like any other message payload - it is just a blob of bytes. The payload bytes might contain a string in some encoding, but that is only of interest to the application sending/receiving the message.
The spec uses the term 'UTF-8 encoded' as lazy shorthand for "encoded with two bytes to represent the length of the payload, followed by the payload itself".
The sentence you cite, although well intentioned to prevent misunderstand about what bytes get sent in the payload, in fact adds nothing but confusion and ought to be removed.