Take the 2-minute tour ×

Can ServiceStack be used for HTTP Server Push (HTTP streaming) from Monotouch & Mono for Droid

My understanding of HTTP streaming is that the connection remains open after the response allowing additional data to be pushed to the client or browser.

RestSharp may also work. If neither of these work suggestions are welcome with Monotouch/droid in mind.

share|improve this question
Your 0% accept rate is going to hinder your responses here. You need to accept some answers on your previous questions. –  Darbio Oct 14 '12 at 11:48
add comment

1 Answer

up vote 2 down vote accepted

Long Polling

ServiceStack services are generally meant for Request / Response type services. The easiest Comet-style / (aka HTTP Push) solution to implement would be using long-polling which I go into a bit of detail on how to do that in this ServiceStack group thread.

Keeping a worker thread open

ServiceStack also has support for a IStreamWriter where you can return an object that writes directly to the HTTP Response Output stream, an example of this can be seen in this web service example service that writes an Image directly to a response stream. The issue here is that if you wanted to keep an open connection you would be blocking the HTTP Worker thread. Long-polling releases the connection after a short-time so

By-pass ServiceStack using your own Custom ASP.NET IHttpAsyncHandler

Finally another option would be to by-pass ServiceStack's web services for this specific task and just implement your own solution on top of ASP.NET's IHttpHandler and IHttpAsyncHandler. You can do this in ServiceStack by registering your own RawHttpHandlers with this:

SetConfig(new EndpointHostConfig {
    RawHttpHandlers = { httpReq => 
           ? new MyStreamingHandler() 
           : null; 

In your handler you can access your ServiceStack dependencies via the Singleton, e.g:

var myDep = EndpointHost.AppHost.TryResolve<IMyDependency>();
share|improve this answer
add comment

Your Answer


