using System;
using System.Timers;
using RestSharp;
using static System.Runtime.InteropServices.JavaScript.JSType;

namespace 心跳维持
{
    internal class Program
    {
        public static System.Timers.Timer timer;
        static void Main(string[] args)
        {
            timer = new System.Timers.Timer();
            timer.Interval = 20000;
            timer.Elapsed += Timer_Elapsed;
            timer.Start();
            Console.ReadLine();
        }

        private static void Timer_Elapsed(object? sender, ElapsedEventArgs e)
        {
            try
            {
                Console.WriteLine("心跳检测");
                var options = new RestClientOptions("http://localhost:19088/");
                var client = new RestClient(options);
                var request = new RestRequest("api/values/HeartBeat");
                var response = client.Post(request);
                string? str1 = response.Content;
                Console.WriteLine(str1);
            }
            catch (Exception)
            {

            }
        }
    }
}
