Having gone through a few reads, including...
- http://anthymecaillard.wordpress.com/2012/06/06/wcf-real-time-web-development-with-long-polling/
- How does a WCF server inform a WCF client about changes? (Better solution then simple polling, e.g. Comet or long polling)
...I think I'm ready to give long polling a shot.
From the second link, my understanding is that the Async Pattern allows us to:
- receive a request on the WCF server
- call BeginMyMethod which returns an IAsyncResult
- hang onto the IAsyncResult somewhere while the thread that received the request "safely rests" - or is released? - without consuming any additional resources
- "whip the IAsyncResult back out" when a relevant business logic event occurs
- use the IAsyncResult to call EndMyMethod, during which we complete the response (i.e., write data back to the client)
Do my assumptions sound correct? I also assume this is vastly scalable due to the above mechanism keeping zero threads tied up waiting for events.
Is this the best way to implement WCF long polling today and with .NET 4.5?