wcfduplex-channel

WCF duplex channel for inter-process communication


I have system like this:

Windows service (WCF, data/events) <-> Web app <-> Web client

I need simultaneous response for clients requests. I have some events from service for clients too. So duplex channel is the way to go. But I need high throughput, because clients calls simultaneously.

Request/reply approach

In order not to serialize channel requests I need more channels for parallel calls, right? But how to handle callback channel then? Ho to keep it still open for receiving events, even on channel errors?

OneWay approach

On channel should be enough (no waiting for data preparation), but how to link data sent to callback with original request, to be able to compose response for client?

What is the way to go? Thank you.


Solution

  • In a simple case, when a web client sends a request to the web app, and web app (possibly) sends a request(s) to WCF service, there's no need in duplex binding at all.

    As for events, raised by the service to be fired in Web client, I'd suggest to use a message broker which supports WebSockets - for example RabbitMQ. It has a plugin compatible with WebSockets and WCF binding.

    Putting things together, one can create a RabbitMQ server, which accepts messages from WCF service and sends it to Web client, which subscribes to the event feed from Javascript.