Wcf – Push data to client using SignalR vs WCF

push-notificationsignalrwcf

I have one WPF client-server application. Now I have scenario like client will connect to server and server will push data to client periodically. I am bit confused about what technology and way should I choose for notification to clients.

SignalR is best for web application I think and I have desktop application. With WCF service, we can implement push notification through Duplex channel and callback. So can you please guide me what are the merits and demerits in using SignalR or WCF service ?

Thanks

Best Answer

Below are my observations from experiences:

SignalR pros:

  • Easy to startup, lower learning curve. You can easily run an example found from web
  • Exception handling (e.g. connection drops, timeouts) is embedded inside the API

SignalR cons:

  • Only supporting HTTP protocol

Duplex pros:

  • Supports TCP in addition to HTTP. This may be a serious performance gain if you know your client types and your system is working in a closed network. Also, working over TCP adds more connection stability than HTTP

Duplex cons:

  • Higher learning curve - harder to startup and have a stable solution. Want to verify it? Download a duplex and a SignalR sample from the web and see how much time you will spend to successfully run each other.
  • You need to handle all the exceptional cases (connection drops, timeouts, etc.)
  • I know I am not the only one who faced serious timeout problems when you want to use the duplex service for a long time. We need to make service calls periodically to keep client connections alive.

By the way, there are APIs exist for JavaScript, Desktop and Silverlight projects to consume SignalR services.

Related Topic