How to save transport context?
- Dominant language
- Rust
- Stars
- 3.7k
- Forks
- 230
- PR merge metrics
- No merged PRs in 30d
Description
I'm trying to implement an MQTTv5 transport, and I have it more-or-less up and running, with fixed request and response topics.
There are two challanges I'm facing:
1. Mqtt is not a one-to-one protocol, where each client will make a different connection to the server, but an aggregating one, where the messages of all clients will be seen through the same stream. The problem with this is that the message ids will collide. I'm thinking about sending randomized message ids instead of the sequential ones, that should mitigate the issue more-or-less. Is that correct?
2. The way MQTTv5 request-response works is that the client publishing the message publishes two pieces of information together with the message: A correlation data (which will be the message id in this case), and a response topic where the client is awaiting the response. Which will be different in cases of requests coming from different clients, but the protocol allows for each message to contain different response topics as well. How can I save this information when decoding the ClientReq, so that when the Response arrives at the Sink I can publish the response to the correct topic?
Basically I'd need a way to save a transport context through the lifecycle of the request, so that it can be accessed when sending the response through the MQTT broker.
Contributor guide
Assessment
This issue has not been assessed yet.