I have the below code being run, it authenticates and holds the connection open. It just doesn’t show any results, I am clearly missing something obvious. I don’t have a timepoint, so only know it can’t be right as its been running for hours without anything. An echo service to prove the connection would be great, this is making testing painful.
var url = "https://stream.companieshouse.gov.uk/companies";
using (var client = new HttpClient())
{
client.Timeout = TimeSpan.FromMilliseconds(Timeout.Infinite);
var authenticationString = "*********";
client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Basic", Functions.Base64Encode(authenticationString));
Console.WriteLine("Key is: " + Functions.Base64Encode(authenticationString));
var request = new HttpRequestMessage(HttpMethod.Get, url);
using (var response = new StreamReader(await client.GetStreamAsync(url)))
{
while (!response.EndOfStream)
{
var message = await response.ReadLineAsync();
Console.WriteLine("message: " + message);
}
}
}