Beispiel #1
0
        public async Task LoginAs(PlayerDto player)
        {
            if (_connectionCache.ContainsKey(Context.ConnectionId))
            {
                _connectionCache.Remove(Context.ConnectionId);
                await Clients.All.SendAsync("PlayerLeft", player);
            }

            _connectionCache.Add(Context.ConnectionId, player);
            await Clients.Others.SendAsync("PlayerEntered", player);

            await Clients.Caller.SendAsync("LoggedIn", new { onlinePlayers = _connectionCache.Values });
        }
Beispiel #2
0
            private static IScheduler _getScheduler(string ip)
            {
                if (!ConnectionCache.ContainsKey(ip))
                {
                    var properties = new NameValueCollection();

                    properties["quartz.scheduler.proxy"]         = "true";
                    properties["quartz.scheduler.proxy.address"] = $"{channelType}://{localIp}:{port}/{bindName}";
                    var schedulerFactory = new StdSchedulerFactory(properties);
                    _scheduler          = schedulerFactory.GetScheduler().Result;
                    ConnectionCache[ip] = _scheduler;
                }
                return(ConnectionCache[ip]);
            }