Unstacking frames when recovering MQTT connexion

Hi everybody,

I have trouble with unstacking frames when recovering MQTT connection : when the gateway unstack accumulated frames, it doesn’t send them in the logic way. (I mean in the chronological order)
For exemple for the same device, an uplink with fcnt = 14 is sent before uplink with fcnt 12… So the application server raise the “UPLINK_FCNT_RESET” error… I have already tried to disable the security about counter frame but I think this is not a good way to solve my problem !
I juste want the chirpstack-gateway-bridge to unstack frame in chronological order.

Is there a solution for that ? Maybe it’s part of paho mqtt library ?

Thanks in avance.


Correct, I believe the in-memory storage of paho does not maintain the order of messages if I remember correctly.

1 Like

Well this is not the answer I expected ! But thanks :slight_smile:
BTW thank you for your work !


It doesn’t mean this can’t be changed :slight_smile:

I believe this behavior is because messages are stored in a map and when reading all messages, the code iterates over the keys (https://github.com/eclipse/paho.mqtt.golang/blob/master/memstore.go#L37 and https://github.com/eclipse/paho.mqtt.golang/blob/master/memstore.go#L92). If you would like to make a feature-request or even better a PR to improve this behavior, that would be much appreciated :+1:

Well I do not really know how to develop in GO. Maybe I’ll try this one day, but not for now. Anyway thx for your answer ! :slight_smile: