eclipse / paho.golang

Go libraries
Other
327 stars 92 forks source link

I could not locate any alternative of mqtt.MessageHandler in this version. #250

Closed MT22067 closed 4 months ago

MT22067 commented 4 months ago

Just like in the paho.mqtt.golang we had this callback function: callback mqtt.MessageHandler which was called whenever mesage was received from the broker. Usage: func (mqtt.Client).Subscribe(topic string, qos byte, callback mqtt.MessageHandler) mqtt.Token What is the alternatives of this in the current module?

MattBrittan commented 4 months ago

Please see this example. If you want a router then see this.

The approach in paho.mqtt.golang was not really ideal because when you connect and there are messages queued it's poaably for the client to receive the messages before it processes the Publish (meaning messages were lost).

MT22067 commented 4 months ago

Thanks! @MattBrittan