Is it possible to implement Forever-Response in ASP.Net Webservice WebMethod?
As defined in the Bayeux specification, Bayeux transports can use the streaming technique (also called the forever response) that allows multiple messages to be sent within the sam开发者_如何学Ce HTTP response. Is it possible to be implemented in ASP.Net (3.5+) WebService as a WebMethod? and How? Thanks for advise.
Yes, FrozenMountain have achieved it with their WebSync product.
The basic concept is that you hold the connection open and push bits of response back to the client as you have them. You probably want to look at the the IHttpAsyncHandler
. This article called Creating an Asynchronous HTTP Handler looks like it could be useful in addition to this Comet post on CodeProject.
If you need this solution to scale I would consider using a dedicated realtime server built with managing 1000's of concurrent long-held connections. This real-time techologies guide contains a number of technologies that might better solve whatever problem you are attempting to solve.
精彩评论