How can I change the Qos of mqtt massage

When I study the code about mqtt in “backend.go.”,I see the line245 : “if token := b.conn.Subscribe(statsTopic, 2, b.statsPacketHandler); token.Wait() && token.Error() !”
Is it Subscribe the Qos 2 of mqtt message? I want to know whether I can change this Qos ?How?


From the paho mqtt client docs:

type Client interface {
    IsConnected() bool
    Connect() Token
    Disconnect(quiesce uint)
    Publish(topic string, qos byte, retained bool, payload interface{}) Token
    Subscribe(topic string, qos byte, callback MessageHandler) Token
    SubscribeMultiple(filters map[string]byte, callback MessageHandler) Token
    Unsubscribe(topics ...string) Token
    AddRoute(topic string, callback MessageHandler)

So yes, the second arg is indeed Qos. You can check the client’s interface implementation at

Thanks for your reply,but I want to know how the loraserver change the Qos except rebuilding the source code.

I don’t think there’s a configuration option to change this. It should be fairly easy to add it as a cli argument or env var, but that means rebuilding the source too.