public async Task<long> PushAsync(ServerPushData data)
        {
            var timer = new Stopwatch();

            timer.Start();
            await InternalPushDataAsync(data);
            timer.Stop();

            return timer.ElapsedMilliseconds;
        }
        public override async Task InternalPushDataAsync(ServerPushData data)
        {
            var request = (HttpWebRequest)WebRequest.Create(_host + "/monitoring/push");

            request.Method = "POST";
            request.ContentType = "application/json; charset=UTF-8";
            request.Accept = "application/json";

            var jsonData = GetObjectJson(data);

            request.ContentLength = jsonData.Length;

            using (var requestStream = await request.GetRequestStreamAsync())
            {
                byte[] postBytes = Encoding.UTF8.GetBytes(jsonData);

                requestStream.Write(postBytes, 0, postBytes.Length);
                requestStream.Close();
            }

            await request.GetResponseAsync();
        }
 private static string GetObjectJson(ServerPushData data)
 {
     return new JavaScriptSerializer().Serialize(data);
 }
 public abstract Task InternalPushDataAsync(ServerPushData data);