views:

148

answers:

1

Hello,

I'm creating multiple asynchronous web requests using IObservables and reactive extensions.

So this creates observable for "GET" web request:

            var tweetObservalue =
            from request in WebRequestExtensions.CreateWebRequest(outUrl + querystring, method)
            from response in request.GetResponseAsync()
            let responseStream = response.GetResponseStream()
            let reader = new StreamReader(responseStream)
            select reader.ReadToEnd();

And I can do

tweetObservable.Subscribe(response => dosomethingwithresponse(response));

What is the correct way of executing multiple asynchronous web requests with IObservables and LINQ that have to wait until other requests have been finished?

For example first I would like to verify user info: create userInfoObservable, then if user info is correct I want to update stats so I get updateStatusObservable then if status is updated I would like create friendshipObservable and so on.

Also bonus question, there is a case where I would like to execute web calls simultaneously and when all are finished execute another observable which will until other calls are finished.

Thank you.