I’ve implemented ICallbackEventHandler to handle data sent from the browser’s javascript. (The user clicks something, causing eventArgument to be sent to the server. The server invokes a service to obtain regarding that value.)
Everything works great so far, but I actually need to invoke three different services with the same eventArgument. Depending on when/if each service responds, its results need to be sent to the browser for it to augment the display.
I’m thinking of creating a thread for each service request. When/if it responds, then I’d send those results to the browser too.
What would be a good way to accomplish this?
//ICallbackEventHandler implementation
public void RaiseCallbackEvent(String eventArgument)
{
returnValue = GetDataFromService1(eventArgument);
}
public String GetCallbackResult()
{
return returnValue;
}
The easiest way to implement this would be to implement javascript in the browser that polls for results from each service, given that each may return at a different time.
Another option might be Reactive Extensions for .NET (Rx). Rx offers “push” notifications to a browser using Observable collections implemented in .NET and “emitted” to javascript.