| 123456789101112131415161718192021222324252627282930313233 |
- using System.Linq;
- using JetBrains.Annotations;
- namespace Abp.RealTime
- {
- /// <summary>
- /// Extension methods for <see cref="IOnlineClientManager"/>.
- /// </summary>
- public static class OnlineClientManagerExtensions
- {
- /// <summary>
- /// Determines whether the specified user is online or not.
- /// </summary>
- /// <param name="onlineClientManager">The online client manager.</param>
- /// <param name="user">User.</param>
- 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);
- }
- }
- }
|