Processing Continuous JSON stream using C#

Hi guys,

I am trying to process Continuous(endless) JSON stream using C#.
I wrote the following code for this, but it doesn't display anything but </html> on the screen.
namespace ConsoleApplication1
    class Program
        static void Main(string[] args){

            var url = "http://localhost/myWebService/endlessJsonStream";

            Task<string> t1 = OnContinuousJason(url);
         private static async Task<string> OnContinuousJason(string url)
            var client = new HttpClient();
            client.Timeout = TimeSpan.FromMilliseconds( Timeout.Infinite);

             var request = new HttpRequestMessage(HttpMethod.Get, url);
             var response = await client.SendAsync(request, HttpCompletionOption.ResponseHeadersRead);
              var body = await response.Content.ReadAsStreamAsync();
              var reader = new StreamReader(body);
              var result = "";
              while (!reader.EndOfStream)
                  result = reader.ReadLine();
              return result;

Open in new window

What should I do to see the continuously coming JSON stream?

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ste5anSenior DeveloperCommented:
Nothing. JSON is an object notation. Objects are limited, thus an endless JSON stream makes not really sense.

btw, why opening a dup?

The key question is: What kind of protocol is used and what kind of web service is it?

A REST service must not send an endless stream. Cause this would violate the definitions of REST: Cause a REST URL represents one resource. Resources are not endless.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
IzzyTwinklyAuthor Commented:
Hi ste5an,

I don't know what is going on with the production code under the hood.
So with that given URL, I can't display the continuous Json stream?
As I know, wcf and rest are used.

ste5anSenior DeveloperCommented:
But this is important. You need to ask the developer or vendor.
IzzyTwinklyAuthor Commented:
Hi ste5an,

it's rest and wcf. I got confirmed.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.