Exemplo n.º 1
0
        public async Task SubscribeStats(string containerid)
        {
            var containers = await _service.GetContainerLists(200);

            var container = containers.FirstOrDefault(p => p.ID == containerid);

            using (var stream = await _service.GetContainerStats(containerid))
            {
                UTF8Encoding encoding = new UTF8Encoding(false);
                using (var reader = new StreamReader(stream, encoding))
                {
                    string nextLine;

                    while ((nextLine = await reader.ReadLineAsync()) != null)
                    {
                        await Clients.Caller.SendAsync("ContainerStats", nextLine);

                        System.Threading.Thread.Sleep(2000);
                    }
                }
            }
        }
Exemplo n.º 2
0
        public async Task <ActionResult> Get()
        {
            var containers = await _service.GetContainerLists(100);

            return(SuccessResponse(containers).ToOk());
        }