Skip to content
This repository was archived by the owner on Mar 27, 2026. It is now read-only.

Commit 9e796bc

Browse files
authored
Derive clean session property from client id and QoS level (#13)
1 parent c005fb9 commit 9e796bc

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

api/remote/remote.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ func (r *Remote) Run(ctx context.Context) error {
3535
if r.Password != "" {
3636
opts.SetPassword(r.Password)
3737
}
38+
opts.SetCleanSession(r.ClientID == "" || r.QoS == 0)
3839

3940
opts.OnConnect = func(c mqtt.Client) {
4041
log.Println("MQTT connected")

main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ func initConfig() {
2828
viper.SetDefault("srv6_net", "fc00::/56")
2929
viper.SetDefault("socket_path", "/var/run/galactic/agent.sock")
3030
viper.SetDefault("mqtt_url", "tcp://mqtt:1883")
31-
viper.SetDefault("mqtt_qos", 0)
31+
viper.SetDefault("mqtt_qos", 1)
3232
viper.SetDefault("mqtt_topic_receive", "galactic/default/receive")
3333
viper.SetDefault("mqtt_topic_send", "galactic/default/send")
3434
if configFile != "" {

0 commit comments

Comments
 (0)