fix: MQTT proxy connection and probe test failures#5215
Merged
Conversation
Changed MQTT endpoint resolution to default to TCP on port 1883 (or 8883 with TLS) instead of forcing WebSocket. Standard MQTT brokers like mqtt.meshtastic.org use TCP, not WebSocket. Users can still explicitly specify WebSocket endpoints using the full uri scheme (e.g., wss://broker.example.com/mqtt). This fixes the 'Engine doesn't support WebSocketCapability' error that was preventing MQTT proxy connections from being established on Android. Connection now successfully: - Connects to Tcp(host=mqtt.meshtastic.org, port=1883, tls=false) - Subscribes to configured topics - Receives MQTT messages from the broker Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
aacfe34 to
c0ac7ee
Compare
c0ac7ee to
e885950
Compare
The probe test was failing with 'CLIENT_IDENTIFIER_NOT_VALID' error because
MqttClient.probe() defaults to an empty client ID. MQTT brokers reject empty
client identifiers as invalid.
Fixed by providing a unique, non-empty client ID for the probe connection:
'MeshtasticProbe-{timestamp}'
This allows the test connection button to successfully probe the broker and
return connection details (assigned client ID, max QoS, keepalive).
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
e885950 to
147a88d
Compare
❌ 10 Tests Failed:
View the top 3 failed test(s) by shortest run time
View the full list of 4 ❄️ flaky test(s)
To view more test analytics, go to the Test Analytics Dashboard |
Copilot AI
pushed a commit
that referenced
this pull request
Apr 24, 2026
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: garthvh <1795163+garthvh@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.
Problem
MQTT proxy connections were failing with two distinct errors:
1. WebSocket Error on MQTT Proxy
The
resolveEndpoint()function was forcing WebSocket protocol for standard MQTT broker addresses. Standard MQTT brokers (likemqtt.meshtastic.org) use TCP (port 1883/8883), not WebSocket.2. Invalid Client ID on Probe Test
The probe test was using an empty client ID by default, which MQTT brokers reject as invalid.
Solution
Fix 1: Use TCP Instead of WebSocket
resolveEndpoint()to default to TCP on standard MQTT ports (1883/8883)ws://broker/mqtt)tcp://broker:1883,ssl://broker:8883by defaultFix 2: Provide Valid Client ID for Probe
MeshtasticProbe-{timestamp}Verification
Live logs showing successful MQTT connection (TCP):
✅ TCP connection established
✅ Topics subscribed successfully
✅ Actively receiving MQTT messages from broker
✅ Full MQTT proxy operational end-to-end
Files Changed
core/network/src/commonMain/kotlin/org/meshtastic/core/network/repository/MQTTRepositoryImpl.kt— Fixed endpoint resolution to use TCPcore/data/src/commonMain/kotlin/org/meshtastic/core/data/manager/MqttManagerImpl.kt— Fixed probe with valid client ID