public override Task OnDisconnectedAsync(Exception exception) { try { Connection con = connectionContext.Remove(Context.ConnectionId).Result; if (con != null) { OnUserChangeOnlineStatus(con.UserId, false); } return(base.OnDisconnectedAsync(exception)); } catch (Exception ex) { SendError(Context.ConnectionId, ex.Message); return(base.OnDisconnectedAsync(exception)); } }