MQTTnet icon indicating copy to clipboard operation
MQTTnet copied to clipboard

Function to disconnect a client from a MQTTnet server

Open deandob opened this issue 4 years ago • 3 comments

Describe the feature request

There appears to be no way for a MQTT Server to disconnect a connected client. We have a use case where an administrator for our system can change the server settings for a particular client connection (eg. username), which requires the client to reconnect. However I cannot locate a function in the server that can disconnect a client by clientId.

Which project is your feature request related to?

  • Server

Describe the solution you'd like

The MQTT.net client has a disconnectAsync function, if there was something similar on the server that can be called during normal operation (not during any of the event handlers) to drop the client connection.

Describe alternatives you've considered

We have a lot of connected clients and it isn't desirable to disconnect every connection as it seems the only way is to .StopAsync the server and start it back up again.

Additional context

I may have missed something in the documentation / source, and if I did the documentation isn't clear about how to do this.

deandob avatar May 11 '20 03:05 deandob

Any feedback on this? I can add a pull request however I want to first check with the developers to see if I'm missing something. Seems to me its an obvious function that is missing.

deandob avatar May 20 '20 02:05 deandob

Any news on this issue. We have a similar case that requires to disconnect/drop clients by clientId. MQTT Server does not exposes any functionality from client manager.

mehyaa avatar Apr 02 '21 13:04 mehyaa

Please check the client status API from the server (GetClientStatusAsync). There you have a disconnect method as well.

chkr1011 avatar Apr 02 '21 16:04 chkr1011

I assume this question is answered.

chkr1011 avatar Sep 14 '22 07:09 chkr1011