Is it possible to use SignalR inside of a service stack project? We currently are using service stack for our REST web API. We have been pleased overall with its architecture, flexibility, etc. Now we are exploring ways to communicate back with our calling clients using event-driven or push techniques (vs polling for status). I should note that we are currently hosting our API in a windows service, using the AppHostHttpListenerBase (vs hosting inside IIS).
Is it possible to configure a dedicated route that would be passed to SignalR Hub somehow, so these two could live side by side? e.g. http://localhost:8000/api/live/jobs/jobid
would hit the SignalR code, but http://localhost:8000/api/jobs/jobid
would route to the current DTO based service stack code.
PS - We would like to continue hosting in self host mode, as we like the flexibility of porting to Mono and running on Linux (vs being tied to IIS).
This blog post describes how to use SignalR with a ServiceStack backend: SignalR, Filters and ServiceStack
To summarize, you have to change the ServiceStack Request behavior to Bufferered,
public HelloAppHost()
: base("Hello Web Services", typeof(HelloService).Assembly)
{
PreRequestFilters.Add((req,res) => req.UseBufferedStream = true);
}
Then you can add [IncomingHub], [OutgoingHub] attributes to the service methods, like Get() and Post(), etc.
As for OWIN support in ServiceStack, don't hold your breath. This thread shows the opinion of the primary maintainer that there is not a strong case for adding support at this time.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With