MQTTnet
MQTTnet copied to clipboard
Function to disconnect a client from a MQTTnet server
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.
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.
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.
Please check the client status API from the server (GetClientStatusAsync). There you have a disconnect method as well.
I assume this question is answered.