private void WsServer_OnMessage(string cid, WebSocket.Model.WSProtocal msg)
        {
            if (msg != null)
            {
                if (_dic1.ContainsKey(cid) && msg.Content != null && msg.Content.Any())
                {
                    var name = Encoding.UTF8.GetString(msg.Content);

                    if (string.IsNullOrEmpty(name))
                    {
                        return;
                    }

                    Task.Factory.StartNew(() =>
                    {
                        while (_dic1.ContainsKey(cid))
                        {
                            try
                            {
                                var data = SerializeHelper.Serialize(ServerInfoDataHelper.GetInfo(name));

                                _wsServer.Reply(cid, new WSProtocal(WSProtocalType.Text, Encoding.UTF8.GetBytes(data)));
                            }
                            catch
                            {
                                _dic1.TryRemove(cid, out DateTime v);
                                break;
                            }
                            ThreadHelper.Sleep(1000);
                        }
                    });
                }
                else
                {
                    _wsServer.Disconnect(cid);
                }
            }
        }
        private void WsServer_OnMessage(string cid, WebSocket.Model.WSProtocal msg)
        {
            if (msg != null)
            {
                if (_dic1.ContainsKey(cid) && msg.Content != null && msg.Content.Any())
                {
                    var json = Encoding.UTF8.GetString(msg.Content);

                    var requestData = SerializeHelper.Deserialize <RequestData>(json);

                    if (requestData == null)
                    {
                        return;
                    }

                    if (requestData.IsCpu)
                    {
                        Task.Factory.StartNew(() =>
                        {
                            while (true)
                            {
                                try
                                {
                                    var data = SerializeHelper.Serialize(ServerInfoDataHelper.GetInfo(requestData.Name, requestData.IsCpu));

                                    _wsServer.Reply(cid, new WSProtocal(WSProtocalType.Text, Encoding.UTF8.GetBytes(data)));
                                }
                                catch
                                {
                                    _dic1.TryRemove(cid, out DateTime v);
                                    break;
                                }
                                ThreadHelper.Sleep(1000);
                            }
                        });
                    }
                    else
                    {
                        Task.Factory.StartNew(() =>
                        {
                            while (true)
                            {
                                try
                                {
                                    var data = SerializeHelper.Serialize(ServerInfoDataHelper.GetInfo(requestData.Name, requestData.IsCpu));

                                    _wsServer.Reply(cid, new WSProtocal(WSProtocalType.Text, Encoding.UTF8.GetBytes(data)));
                                }
                                catch
                                {
                                    _dic1.TryRemove(cid, out DateTime v);
                                    break;
                                }

                                ThreadHelper.Sleep(1000);
                            }
                        });
                    }

                    return;
                }
                else
                {
                    if (msg.Content != null && msg.Content.Any())
                    {
                        var s = Encoding.UTF8.GetString(msg.Content);

                        if (s == "getinfo")
                        {
                            _dic1.TryAdd(cid, DateTimeHelper.Now);

                            return;
                        }
                        else
                        {
                            return;
                        }
                    }
                }
            }
            _wsServer.Disconnect(cid, new WSProtocal(WSProtocalType.Close, null));
        }