New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[CHANGED] MQTT: Support for topics with .
character.
#4243
Conversation
The `.` character will be transformed to `//` in NATS subject. For instance an MQTT message published on `spBv1.0/plant1` would be received by a NATS subscriber as `spBv1//0.plant1`. Conversely, a NATS message published on `spBv1//0.plant1` would be received by an MQTT subscriber as `spBv1.0/plant1`. Resolves #1879 Resolves #3482 Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is //
ilegal in a MQTT topic today? Meaning we will not encounter it natively in an MQTT application yes?
It is legal actually, but the point of this PR is converting Btw, once that is approved/merged, I will have to do a PR against the documentation mentioned above to update the table. |
So what happens if we encounter |
No, if it comes from MQTT, say as
in the TestMQTTTopicAndSubjectConversion test. |
See nats.docs PR: nats-io/nats.docs#601 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Previously ' ' and '.' were not supported for MQTT topics until nats-io#4243 brought in support for '.'. However the error message for unsupported characters appears to not have been updated. This simply updates the error message. Had an example of a MQTT client trying to publish to `spBv1.0/Field Devices/Some Device/Some Topic` and the error message indicated that both '.' and ' ' were unsupported which was misleading as only ' ' is unsupported.
Previously ' ' and '.' were not supported for MQTT topics until [#4243](#4243) brought in support for '.'. However the error message for unsupported characters appears to not have been updated. This simply updates the error message. Had an example of a MQTT client trying to connect to `spBv1.0/Field Devices` and the error message indicated that both '.' and ' ' were unsupported which was misleading as only ' ' is unsupported. Signed-off-by: Tom Hollingworth <tom.hollingworth@spruiktec.com>
Previously ' ' and '.' were not supported for MQTT topics until #4243 brought in support for '.'. However the error message for unsupported characters appears to not have been updated. This simply updates the error message. Had an example of a MQTT client trying to publish to `spBv1.0/Field Devices/Some Device/Some Topic` and the error message indicated that both '.' and ' ' were unsupported which was misleading as only ' ' is unsupported.
Previously ' ' and '.' were not supported for MQTT topics until #4243 brought in support for '.'. However the error message for unsupported characters appears to not have been updated. This simply updates the error message. Had an example of a MQTT client trying to publish to `spBv1.0/Field Devices/Some Device/Some Topic` and the error message indicated that both '.' and ' ' were unsupported which was misleading as only ' ' is unsupported.
The
.
character will be transformed to//
in NATS subject. For instance an MQTT message published onspBv1.0/plant1
would be received by a NATS subscriber asspBv1//0.plant1
.Conversely, a NATS message published on
spBv1//0.plant1
would be received by an MQTT subscriber asspBv1.0/plant1
.Resolves #1879
Resolves #3482
Signed-off-by: Ivan Kozlovic ivan@synadia.com