コード例 #1
0
        public void Broadcast(EventResult result)
        {
            IEnumerable <Player> targets = playerRepository.Get(result) ?? Enumerable.Empty <Player>();

            foreach (var p in targets.Where(t => t != null))
            {
                _hubContext.Clients
                .Client(p.ConnectionId)
                .SendAsync("broadcast", result.ToJson());
                //TODO: Question, how do we keep track of client side eventhandlers? Broadcast only exists in stringly format here
            }
        }