-
Notifications
You must be signed in to change notification settings - Fork 559
Open
Labels
DocumentationIssue could be resolved by improving the documentationIssue could be resolved by improving the documentation
Description
I've made this sample program to test what happens when the publisher loses and recovers connection:
package main
import (
"fmt"
"strconv"
"time"
mqtt "github.com/eclipse/paho.mqtt.golang"
)
func main() {
opts := mqtt.NewClientOptions().
AddBroker("127.0.1.1:1883").
SetOrderMatters(true).
SetAutoReconnect(true).
SetClientID("sender").
SetCleanSession(false)
client := mqtt.NewClient(opts)
if token := client.Connect(); token.Wait() && token.Error() != nil {
panic(token.Error())
}
i := 0
for {
client.Publish("test", 1, false, strconv.Itoa(i))
i++
time.Sleep(1 * time.Second)
}
}I start the program and then I block outbound traffic with:
iptables -A OUTPUT -p tcp --dport 1883 -d 127.0.1.1 -j DROP
When the connection is recovered (I remove the iptables rule), the messages are sent out of order, even though SetOrderMatters is true: (capture from the loopback interface)

Is this intended behaviour? How can I make sure packets are sent in order? I want them to arrive in order at the subscriber.
Thanks,
Jan.
Metadata
Metadata
Assignees
Labels
DocumentationIssue could be resolved by improving the documentationIssue could be resolved by improving the documentation