# Implementing the Request/Reply pattern using MQTT in mobile applications

**URL:** <https://community.solace.com/t/implementing-the-request-reply-pattern-using-mqtt-in-mobile-applications/4400>\
**Category:** General Discussions\
**Tags:** solace-cloud, ios, solacepubsub\
**Created:** [June 19, 2025, 3:40pm UTC](https://community.solace.com/t/implementing-the-request-reply-pattern-using-mqtt-in-mobile-applications/4400 "2025-06-19T15:40:18Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Srikanth\_bethi](https://yyz1.discourse-cdn.com/solace/user_avatar/community.solace.com/srikanth_bethi/32/2280_2.png) [@Srikanth\_bethi](https://community.solace.com/u/Srikanth_bethi)\
**Post date:** [June 19, 2025, 3:40pm UTC](https://community.solace.com/t/implementing-the-request-reply-pattern-using-mqtt-in-mobile-applications/4400/1 "2025-06-19T15:40:18Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Solly-AI](https://yyz1.discourse-cdn.com/solace/user_avatar/community.solace.com/solly-ai/32/2305_2.png) [@Solly-AI](https://community.solace.com/u/Solly-AI)\
**Post date:** [June 19, 2025, 3:41pm UTC](https://community.solace.com/t/implementing-the-request-reply-pattern-using-mqtt-in-mobile-applications/4400/2 "2025-06-19T15:41:03Z")

</div>

**Hi there, I’m Solly AI, I generate responses to your questions using the power of the [Solace Agent Mesh](https://github.com/SolaceLabs/solace-agent-mesh)**:

**Please remember that AI technology can make mistakes so ensure that you read our [Disclaimer](https://docs.solace.com/docs-ai-disclaimer.htm).**

**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:

1. For basic messaging capabilities:

2. For iOS implementation:

3. For correlation handling:

Relevant sources:

- [Using MQTT](https://docs.solace.com/API/MQTT/Using-MQTT.htm)
- [iOS Simulator-Compatible Libraries](https://solace.community/t/ios-simulator-compatible-libraries-or-universal-versions-for-solace-sdk/2109)
- [Queue-Based Message Consumption Using CocoaMQTT](https://solace.community/t/queue-based-message-consumption-using-cocoamqtt-in-solace-in-ios-swift/4137)

For specific implementation details and code examples, please refer to the documentation links provided above.

---

<div class="post-metadata">

**Author:** ![Srikanth\_bethi](https://yyz1.discourse-cdn.com/solace/user_avatar/community.solace.com/srikanth_bethi/32/2280_2.png) [@Srikanth\_bethi](https://community.solace.com/u/Srikanth_bethi)\
**Post date:** [June 24, 2025, 9:17am UTC](https://community.solace.com/t/implementing-the-request-reply-pattern-using-mqtt-in-mobile-applications/4400/3 "2025-06-24T09:17:30Z")

</div>

@marc @amackenzie : Please look into my query and provide me your inputs. Thanks

---

<div class="post-metadata">

**Author:** ![jhonnmick](https://yyz1.discourse-cdn.com/solace/user_avatar/community.solace.com/jhonnmick/32/2482_2.png) [@jhonnmick](https://community.solace.com/u/jhonnmick)\
**Post date:** [July 29, 2025, 8:05pm UTC](https://community.solace.com/t/implementing-the-request-reply-pattern-using-mqtt-in-mobile-applications/4400/4 "2025-07-29T20:05:24Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Srikanth\_bethi](https://yyz1.discourse-cdn.com/solace/user_avatar/community.solace.com/srikanth_bethi/32/2280_2.png) [@Srikanth\_bethi](https://community.solace.com/u/Srikanth_bethi)\
**Post date:** [August 18, 2025, 5:30am UTC](https://community.solace.com/t/implementing-the-request-reply-pattern-using-mqtt-in-mobile-applications/4400/5 "2025-08-18T05:30:25Z")

</div>

[@marc](https://community.solace.com/u/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`).

1. Each device **sends a request** with its own `correlationId`.
2. The **reply is published to the same reply topic**.
3. ✅ Each device gets _all_ replies.
4. ❌ 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?
