Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
UwpPublishToStreamingDataSet.cs
private async void ReportVisitorsAsync(string pushUrl, int totalVisitors, int totalVisitorsIdentified, string centerName)
{
var visitorsMeasurement = new
{
TotalVisitors = totalVisitors,
TotalRecognizedVisitors = totalVisitorsIdentified,
timeStamp = DateTime.Now,
CenterName = centerName
};
var jsonString = JsonConvert.SerializeObject(visitorsMeasurement);
var request = WebRequest.Create(pushUrl);
request.Method = "POST";
request.ContentType = "application/json";
using (var requestWriter = new StreamWriter(await request.GetRequestStreamAsync()))
{
requestWriter.Write(jsonString);
requestWriter.Flush();
}
await request.GetResponseAsync();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment