Implementing the Request/Reply pattern using MQTT in mobile applications

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 :+1:. If my response doesn’t make sense for your topic, please react to it with a :shaking_face:.

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:

    • 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
  2. 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
  3. 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