/// <summary>
 /// 向 client 发送要处理的直播间信息
 /// </summary>
 /// <param name="client"></param>
 /// <param name="room"></param>
 private static void SendTask(CrawlerClient client, StreamRoom room)
 {
     room.StartTime = DateTime.Now;
     room.Clients.Add(client.Name);
     client.CurrentJobs.Add(room);
     WebsocketServer.SendString(client.WebSocketContext, JsonConvert.SerializeObject(new Command {
         Type = CommandType.Issue, Room = room
     }));
     Console.WriteLine($@"下发 {room.Roomid} 给 {client.Name}");
 }
        /// <summary>
        /// 处理新 websocket 连接
        /// </summary>
        /// <param name="webSocket"></param>
        public static void NewClient(IWebSocketContext webSocket)
        {
            var query = webSocket.RequestUri.Query
                        .TrimStart('?').Split('&')
                        .Select(x => x.Split('='))
                        .Where(x => x.Length == 2)
                        .ToDictionary(x => Uri.UnescapeDataString(x[0]), x => Uri.UnescapeDataString(x[1]));

            if (!query.TryGetValue("version", out string version) || version != Static.VERSION)
            {
                webSocket.WebSocket.CloseAsync();
                return;
            }

            if (!query.ContainsKey("max"))
            {
                webSocket.WebSocket.CloseAsync();
                return;
            }

            string name = (webSocket as Unosquare.Net.WebSocketContext).Headers.Get("CertSdn").Remove(0, 3);

            if ((!int.TryParse(query["max"], out int max)) || name.Length < 3 || name.Length > 20 || (!Regex.IsMatch(name, "[A-Za-z0-9]+")))
            {
                webSocket.WebSocket.CloseAsync();
                return;
            }

            if (ConnectedClient.Any(x => x.Name == name))
            {
                webSocket.WebSocket.CloseAsync();
                return;
            }

            CrawlerClient newclient = new CrawlerClient {
                Name = name, MaxParallelTask = max, WebSocketContext = webSocket
            };

            lock (lockObject)
            {
                ConnectedClient.Add(newclient);
                TelegramMessage.Append(DateTime.Now.ToString("HH:mm:ss.f")).Append("\n").Append(newclient.Name).Append(" #connect\n\n");
            }
        }