google / google/tarpc

How to save transport context?

Open
#392 24 comments 0 reactions 0 assignees View on GitHub
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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.