Equivalent to Task.Start with observables

Greetings,
I’m working with a System.Net.Http as I want to use HTTPPost to send data.

The .HttpClient.PostAsync node outputs a Task.
The way I’m currently looking at it is to wrap PostAsync in a Scheduler.Start() region but I’m not sure if this is right, since I’ll be changing the output into an observable:

Is this approach okay?

you would only need to wrap a sync (blocking) method in a Start region, but PostAsync is already async and is meant to be called in a sync context and then be awaited (continue with some code when finished).

so you can call the PostAsync on Update in a cache region, capture the observable that you get from ToObservable, and then react when the observable fires (task finishes). you can react on the observable with a ForEach or so…

1 Like

Thanks Teb, I’ll try it out

H

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.