2

I like how Web API allows to create a RESTful interface. Also I like how Signal-R allow you to push updates to clients.

But is OK to use both at the same time? I mean, Signal-R keeps a connection to the server all the time (or simulates that with long polling), is not a waste of resources to continue creating different connection to perform interactions in Web API?

I could interact with the server through the Signal-R connection, but then I loose all the great Web API functionality.

Cheers.

vtortola
  • 32,045
  • 25
  • 144
  • 246

1 Answers1

4

I've seen this question pop up repeatedly and my answer has always been that you should use SignalR only for real-time messaging (e.g. either notifications from the server or inter-client messaging) and use WebAPI everywhere else (e.g. client just telling the server to do something/asking for some resource).

While you could use SignalR for the latter, once you get to a certain scale you are incurring a massive penalty with respect to how each message to the server has to be fanned out across a backplane implementation just so that eventually only the server actually needs to acknowledge it.

Drew Marsh
  • 32,415
  • 2
  • 79
  • 100