Reputation: 1382
I'm designing a web application that is essentially an administration panel for an underlying service. The way I'm currently designing it is such that I have a few partial views that are rendered into a main view, and when any of those partial views issue a command to the server using AJAX, all the partial views refresh using AJAX to reflect the model's new state.
With all the hoopla about SignalR, I'm wondering if there would be any advantage to using SignalR clients + hubs to issue the commands instead of AJAX + Controllers. It seems that SignalR wouldn't support rendering views the way Controllers + AJAX does, so I would essentially have to micro-manage the partial views, so to speak, or use a rendering engine to render the view on server side and send it down as a string. So this would be a disadvantage. Conversely, an advantage would be being able to update multiple instances of the application at once, which would be a desirable feature to have.
Can anyone elaborate on using this approach? Is there a way to leverage all MVC features using SignalR instead of AJAX?
Upvotes: 1
Views: 434
Reputation: 3169
When you move away from using the controllers, you lose the simplicity of authorization annotations and the returning of views etc, as you mentioned. The benefit of signalR is duplex communication, so to use MVC controllers in duplex (live) communication, you need web sockets.
Try this article (plus part 2 etc)
Upvotes: 1