Closed alec1o closed 1 year ago
The WatsonWsServer has a DisconnectClient method that provides this function.
Thanks!
wss.ClientConnected += (_, input) =>
{
string token = input.HttpRequest.Headers.Get("token");
if (string.IsNullOrWhiteSpace(token))
{
// disconnecting client
wss.DisconnectClient(input.Client.Guid);
return;
}
if (MyClass.VerifyToken(token) is false)
{
// disconnecting client
wss.DisconnectClient(input.Client.Guid);
return;
}
// .. my logic here
};
I wanna disconnect a client, sample code below.