Dear Solace Support Team,
I am exploring the possibility of implementing the Request/Reply messaging pattern using MQTT in a mobile application (iOS).
Could you please confirm if this is feasible using Solace MQTT support for mobile clients? If yes, I would appreciate it if you could provide relevant documentation, best practices, or implementation guidelines.
Additionally, I understand that correlation ID plays a key role in the request/reply pattern and is natively supported in the Solace SDK. Is this correlation ID functionality also achievable when using MQTT clients or third-party MQTT frameworks (such as CocoaMQTT for iOS)?
Looking forward to your insights and support.
Hi there, I’m Solly AI, I generate responses to your questions using the power of the Solace Agent Mesh:
Please remember that AI technology can make mistakes so ensure that you read our Disclaimer.
AI Generated responses are a work in progress, your help in evaluating my response would be awesome! If my response makes sense, please mark it as a solution or give a
. If my response doesn’t make sense for your topic, please react to it with a
.
Looking at the documentation and community discussions about implementing Request/Reply messaging using MQTT in iOS applications:
MQTT v5.0 provides better support for request/reply interactions compared to MQTT 3.1.1. Here are the key points:
-
For basic messaging capabilities:
- MQTT supports QoS 0 (at most once) and QoS 1 (at least once) delivery
- QoS 1 provides guaranteed message delivery, equivalent to Solace guaranteed messaging
- MQTT v5.0 adds support for request-reply interactions through features like User Properties and correlation data
-
For iOS implementation:
- CocoaMQTT library can be used to establish MQTT connections
- Supports both WebSocket (port 8443) and direct MQTT (port 8883) connections
- MQTT v5.0 is recommended over MQTT 3.1.1 for better features and interoperability
-
For correlation handling:
- MQTT v5.0 provides built-in support for correlation data and response topics
- Can implement request-reply patterns using these MQTT v5.0 features
Relevant sources:
For specific implementation details and code examples, please refer to the documentation links provided above.
@marc @amackenzie : Please look into my query and provide me your inputs. Thanks
Yes, implementing the Request/Reply pattern using MQTT in iOS mobile apps is feasible with Solace, especially if you use MQTT v5.0, which supports response topics and correlation data—key features for request/reply interactions. While Solace’s native SDK offers built-in support for correlation IDs, similar functionality can be achieved with third-party libraries like CocoaMQTT by manually setting user properties and handling reply topics. For best results, use MQTT over WebSockets, and ensure your broker supports MQTT v5.0. Documentation and examples are available in Solace’s developer guides and CocoaMQTT GitHub repo.
@marc @amackenzie @jhonnmick
Thanks for your response. I need your assistance to help me fulfill the requirement mentioned below.
Problem Statement:
We have three devices subscribed to the same MQTT topic. Each device sends a request with its own unique correlationId. When a reply is published, all three devices receive it — but in reality, only one device should get the relevant response. This results in unnecessary messages being delivered to non-requesting clients.
step by step explanation :
3 devices subscribe to the same topic (say common/request/topic).
- Each device sends a request with its own
correlationId.
- The reply is published to the same reply topic.
Each device gets all replies.
Only one reply is actually relevant, but others get “noise.”
Could you please suggest the best approach to ensure that only the requesting device receives its corresponding reply?