rumqtt
rumqtt copied to clipboard
Rumqttd: Support for v3.1.1 & v5 on the same port
Expected Behavior
Most brokers support both protocols on the same port. Allowing the connect packet determine which protocol is used (If both are supported...).
Current Behavior
This currently is not supported and you are required to start two ports with one protocol on each.
I've tried my best at getting a prototype to work for this but having some trouble. Also don't really want to rewrite large parts of the current implementation of this is not something that is being planned or wanted.
Hey, is there any significant advantage of having them on same port?
Currently, as Network<P>
has the P: Protocol
, it knows how to read the packets ( including connect ), but if we want to change it to read one packet first to determine the protocol, that might affect us in future in case we want to add support for different protocol. Because then we won't know how to read the very first packet ( e.g. connect )
Hi. It does somewhat complicate the configuration process. Having one port allows ease in configuration and easier support for the clients connecting. It is not a deal breaker and more of a nice to have.
As for reading the packets. Since both 3.1.1 and 5 have similar header and start of connect I tried to have P: Protocol be changed after reading as far but my rust knowledge did not get me very far and struggled to get a understandable and robust solution. Maybe there is a smarter way, will try to look into how other brokers handles this 👍🏼
As for reading the packets. Since both 3.1.1 and 5 have similar header and start of connect I tried to have P: Protocol be changed after reading
Agreed. I wanted to say, if we plan to add other protocol to the broker ( as broker is generic for any pub/sub protocol ) which might have a different start of connect, then it would add up some complexity
If it doesn't provide much benefit, then let's keep it on different ports, atleast for now. Will see how it goes later 😁