Exemple #1
0
        private void AddUserToConnectionMap(UsernameVo username)
        {
            // Check if user is already existent in connection map
            if (requestorConnections.ContainsKey(username))
            {
                requestorConnections.AddValueToSet(username, Context.ConnectionId);
            }
            else
            {
                requestorConnections.Add(username, Context.ConnectionId);
            }

            _logger.LogInformation($"Number of users in donatorConnections: {requestorConnections.Count()}");
        }
Exemple #2
0
        public override Task OnConnected()
        {
            string key          = Context.QueryString["Key"];
            string connectionId = Context.ConnectionId;

            if (string.IsNullOrEmpty(key))
            {
                return(base.OnConnected());
            }

            ConnectionMap.Add(key, connectionId);

            BroadcastConnectionMap();

            return(base.OnConnected());
        }