bytebeamio / rumqtt

The MQTT ecosystem in rust
Apache License 2.0
1.65k stars 255 forks source link

rumqttc: change connection options after creating client instance #886

Closed xiaocq2001 closed 2 weeks ago

xiaocq2001 commented 4 months ago

Expected Behavior

We do not appear to currently have a way to connect with clean_session = True on the initial connect, and then change to using clean_start = False on successive reconnects (i.e. we want to start a clean session, and then if the connection is lost, try and re-establish the same session).

Current Behavior

The options are saved in EventLoop instance, there is no way to modify it after the client and event loop is created. Re-connection uses the options in EventLoop and there is no way to modify them.

swanandx commented 4 months ago

Re-connection uses the options in EventLoop and there is no way to modify them.

mqttoptions in eventloop are public ( exposed by pub ), you can modify then there before calling poll again right?

memark commented 3 weeks ago

Does that solve your issue @xiaocq2001?

xiaocq2001 commented 3 weeks ago

@memark yes.

memark commented 2 weeks ago

@xiaocq2001 Great! Please close this issue then.