feat(rumqttd): configurable protocol version for WebSocket listeners#1039
Open
conglp90 wants to merge 1 commit into
Open
feat(rumqttd): configurable protocol version for WebSocket listeners#1039conglp90 wants to merge 1 commit into
conglp90 wants to merge 1 commit into
Conversation
Add ProtocolVersion enum (v4/v5) to ServerSettings, allowing WebSocket listeners to be configured with either MQTT v4 or v5 protocol. Previously, WebSocket listeners were hardcoded to V4. This patch reads a 'protocol' field from config (default: v4 for backward compat) and spawns the appropriate Server<V4> or Server<V5>. Changes: - src/lib.rs: Add ProtocolVersion enum + protocol field to ServerSettings - src/server/broker.rs: Match on protocol when spawning WS servers Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
WebSocket listeners are currently hardcoded to MQTT v4 (
broker.rs:251), with a TODO comment://TODO: Add support for V5 procotol with websockets. Registered in config or on ServerSettingsThis PR resolves that TODO by adding a
protocolfield toServerSettings.Changes (~27 LOC, 2 files)
src/lib.rsProtocolVersionenum (V4,V5) with serde support andDefault = V4#[serde(default)] pub protocol: ProtocolVersiontoServerSettingssrc/server/broker.rsProtocolVersionconfig.protocolwhen spawning WS servers →Server<V4>orServer<V5>Config example
Backward compatibility
protocoldefaults tov4via#[serde(default)], so existing configs work unchangedTesting
Tested with:
response_topic+correlation_data