Last post Feb 22, 2017 10:00 PM by deepalgorithm
Feb 16, 2017 06:54 PM|nguyenhthai|LINK
So currently I have a self-host WCF service that is using duplex polling to communicate with a Silverlight client. As Silverlight is going away, the client will be replaced with HTML and JS. However, to communicate with the WCF service, I don't think there
is any library that can straight up support that. So did some research and arrived with couple solutions: long polling, adding WebSocket to the WCF service, and using SignalR. Using long polling might not be a good idea in my case for some reasons. Adding
WebSocket is suitable but it would take much more time to dig in the old code to implement the support. So SignalR is seem to me a middle ground since it would take care of the implementation for the transport of the communication and there is JS library provided
to communicate with the SignalR hub.
So my question is that how can I add SignalR to my project that it can use the current duplex code from the WCF service and allows the client to call it from JS? Do I have to add WCF service end point for the SignalR hub in order to make it work with the
WCF? Do I just need to add the Hub implementation for the service and it will just work without any modification to the service code?
Feb 17, 2017 06:52 AM|Jean Sun|LINK
Do I have to add WCF service end point for the SignalR hub in order to make it work with the WCF?
As far as I know, you can't call the duplex WCF service with client script like angularjs or Jquery.
Feb 22, 2017 10:00 PM|deepalgorithm|LINK
It's not clear why you need to keep your WCF Service if you plan on replacing your Silverlight client with a modern web app & SignalR. If the issue is that you want to preserve your business logic, then you can still do that even if you switch to SignalR.
You would create a Hub and methods that just re-use any business logic that you have in your service implementation. There may be some re-work and minor refactoring.
If you decide to keep your WCF Service - your future modern web app will have bi-directional communication with your SignalR instance. From your SignalR Hub, you would call your WCF service as you normally would to fetch your data or perform action
and return it to your user via SignalR.