public async override Task OnConnectedAsync()
        {
            if (_client.ContainsKey(UniqueKey))
            {
                await NotifyUserDuplicated(UniqueKey);
            }

            var profile = new CSharpProfile(UniqueKey, Context.ConnectionId, Name);

            if (_client.TryAdd(UniqueKey, profile))
            {
                WriteLog($"Connected: {UniqueKey}");

                await NotifyUserConnected(profile);
            }
        }
Esempio n. 2
0
 public NotifyUserConnectEvent(string connectionId, string uniqueKey, CSharpProfile profile) : base(connectionId, uniqueKey, profile)
 {
 }
 protected virtual async Task NotifyUserDisConnected(CSharpProfile profile)
 {
     await Clients.Client(Context.ConnectionId)
     .SendCoreAsync("NotifyUserDisConnected",
                    new[] { new NotifyUserDisConnectEvent(Context.ConnectionId, profile.Id, profile) });
 }
 public NotifyUserEventBase(string connectionId, string uniqueKey, CSharpProfile profile)
 {
     ConnectionId = connectionId;
     UniqueKey    = uniqueKey;
     Profile      = profile;
 }