using System.Linq;
using JetBrains.Annotations;
namespace Abp.RealTime
{
///
/// Extension methods for .
///
public static class OnlineClientManagerExtensions
{
///
/// Determines whether the specified user is online or not.
///
/// The online client manager.
/// User.
public static bool IsOnline(
[NotNull] this IOnlineClientManager onlineClientManager,
[NotNull] UserIdentifier user)
{
return onlineClientManager.GetAllByUserId(user).Any();
}
public static bool Remove(
[NotNull] this IOnlineClientManager onlineClientManager,
[NotNull] IOnlineClient client)
{
Check.NotNull(onlineClientManager, nameof(onlineClientManager));
Check.NotNull(client, nameof(client));
return onlineClientManager.Remove(client.ConnectionId);
}
}
}