I’ve got an existing WCF service that we’ve been using to communicate with a Silverlight client, and hence have been using it with the NetTCP binding. I’d like to start using this same service with a JavaScript client, ideally modifying the service as little as possible (i.e., allowing Silverlight and JS clients to call the same duplex service). Ideally this would happen through a reasonably performant and scalable tech, like WebSockets, rather than a hack like Comet.
What’s the best way to do this?
Adding WebSocket support to the service (through the NetHttpBinding) would seem like one obvious way to do it – but there doesn’t seem to be any documentation on how to call the resulting service from JavaScript. I suppose I could configure it to use a text-based transport, instead of the default binary transport, and then hack together some sort of JavaScript-based SOAP client (perhaps using WSDL2JS) to call it. That feels like it ought to work, but also pretty awkward, and with some pieces in the mix that haven’t been well documented.
I could also re-implement my service in a framework like XSockets or SuperWebSocket, but that’s some real work, and keeping it in sync with the WCF implementation would be more on top of that.
Any other thoughts?
I am one of the guys behind XSockets.NET. I can help you with this one I hope.
XSockets has a “external” API that you can use from WCF (or anything else talking TCP/IP and .NET) to send messages to the XSockets server. The server will then pass the messages (pub/sub pattern) to the client(s) and vice versa.
So, there will be almost no changes to your WCF.
Just tell me if you need an example, and I will provide one for you. Just send me an email on uffe at xsockets dot net and we can take it from there.
EDIT: Created a example on howto boost your WCF to realtime. It´s on GitHub: Boost WCF to RealTime
Regards
Uffe, Team XSockets