Пример #1
0
 public WebSocketMiddleware(RequestDelegate next, WebSocketManager manager, IServiceScopeFactory factory, IConfiguration configuration)
 {
     this.next     = next;
     this.manager  = manager;
     userManager   = factory.CreateScope().ServiceProvider.GetService <UserManager <Player> >();
     Configuration = (ConfigurationRoot)configuration;
 }
Пример #2
0
        public static WebSocket[] GetPlayerSockets(GameDataModel game, WebSocketManager manager)
        {
            var players     = game.PlayerIDs.Split(",");
            var playerCount = CountPlayers(players);

            WebSocket[] playerSockets = new WebSocket[playerCount];
            for (int i = 0; i < playerSockets.Length; i++)
            {
                playerSockets[i] = manager.GetSocketById(players[i]);
            }
            return(playerSockets);
        }