void ClientDisconnected(object sender, EventArgs e) { var sconn = sender as WebSocketConnection; if (sconn != null && Connections != null && Connections.Count > 0) { Connections.Remove(sconn); _localServer.DisconnectRequest(sconn.Request); } }
private void ClientDisconnected(object sender, EventArgs e) { var c = Connections; if (sender is WebSocketConnection sconn && c?.Count > 0) { try { c.Remove(sconn); _localServer.DisconnectRequest(sconn.Request); } catch { } } }
void ClientDisconnected(object sender, EventArgs e) { var sconn = sender as WebSocketConnection; var c = Connections; if (sconn != null && c != null && c.Count > 0) { try { c.Remove(sconn); _localServer.DisconnectRequest(sconn.Request); } catch { } } }