Last post Sep 23, 2014 02:51 AM by robin.sedlaczek
Sep 19, 2014 09:45 AM|ssmith1111|LINK
Is there any need for the normal MVC controller with SignalR hubs? Shouldn't the hubs be used as the controller and then not use anything else?
Sep 22, 2014 03:14 AM|Kevin Shen - MSFT|LINK
Thanks for your post here.
For How to use SignalR in MVC Project , I suggest that you can try the tutorial below:
And Hubs should not be as controller ,for they are two different things. hubs belong the signalr ,while the controller belong to the mvc project.
Sep 22, 2014 03:58 AM|robin.sedlaczek|LINK
can you please explain your problem or question a little bit more in detail?
SignalR is not really a substitution for MVC and you do not need to use SignalR with ASP MVC applications. It is an on-top framework for real-time communication over the web.
As always: using ASP MVC, WebAPI, SignalR or something else depends on your needs and requirements.
Best regards from Berlin!
Sep 22, 2014 07:50 PM|ssmith1111|LINK
If you're building a Single Page App would there be any reason to not use the Hub's as the service layer without anything else. Basically as a replacement for web services or as a controller layer. Controller being anything that maps requests to actions
and then resolves the respond into a View.
Is there any foreseeable issues with just building an entire service layer out of hubs? Security issues, performance, scalability?
Sep 23, 2014 02:49 AM|robin.sedlaczek|LINK
I think there is no reason to not use hubs for service layers. Completely. If I look into the SignalR source code and compare it with e.g. WebAPI source code, there is more or less the same effort to dispatch requests to services. But that is only a first-view-comparison.
I did not measure the performance of both and compared them. In my opinion, one of the SignalR design goals was to enrich single page applications with real-time communication.
Concerning security, SignalR is embedded in the security concept of the web application. It runs in the OWIN pipeline! So you can configure all the kinds of security you know from e.g. ASP.NET MVC and WebAPI. They run in the same pipeline. Please have a
http://www.asp.net/signalr/overview/signalr-20/security/introduction-to-security for more details. Another good starting point for security is, in my humble opinion, the guys from Thinktecture: http://www.thinktecture.com/ Use
SignalR as your service layer, configure SSL at your server and use some OWIN authentication/authorization mechanism (cookie authentication, OAuth 2, OpenID Connect). That is a good base to be secure. But never stop investigating your code for security problems
(I think you know that)! :)
SignalR is highly scalable. A good starting point is that article: http://www.asp.net/signalr/overview/signalr-20/performance-and-scaling/scaleout-in-signalr
Hope that helps a bit! If not, do not hesitate to contact me! Would be happy to hear about your results and experiences! :)
Sep 23, 2014 02:51 AM|robin.sedlaczek|LINK
Please let me show your my blog post, where I tried to answer some similar questions coming from the audience of my last talk about SignalR. Maybe that helps a bit, too. Find it here: http://robinsedlaczek.wordpress.com/2014/09/11/inside-signalr-addressing-clients-return-values-broken-connections-and-security/