WCF Client-Server Synchronization: Poll vs. Binding

I am working on a WCF client-server application. where the client must constantly synchronize with the server (at least every 10 seconds). At the moment I am polling a server to see if something has changed. If so, changes (sometimes dozens of db records) are propagated to the client.

My design looked a bit awkward, so I took a look at how gtalk clients (and other XMPPs) support synchronization. According to this Wikipedia article , XMPP abandoned the polling approach and now uses HTTP binding .

I believe the same can be done for WCF. I think that 99% of WCF applications today are just 1) open the connection, 2) complete the transaction, and 3) close the connection.

So my questions are:

  • Does anyone know an example of how to implement such an asynchronous binding method with WCF?
  • What effect can u have on the number of server clients, since connections must be supported.
  • Any other flaws?
+4
source share
1 answer
  • Such an asynchronous approach can be implemented by duplex binding. WCF provides WSDualHttpBinding, which consists of two portable HTTP transports. One from client to server and the second from server to client. The approach is to call the server from the client at the beginning of communication. The server stores the client callback channel and uses it to push updates as necessary. This can be further extended to the full publication of the publication messaging template.

  • By default, the server must support a service instance for each connected client proxy (for each session). You must configure throttling services correctly to allow many clients to connect. The effect on the server and the number of clients depends on the implementation of the service.

  • WSDualHttpBinding has limitations. For example, transport security is not allowed - only message protection can be used, streaming is unacceptable, a reliable session is required, etc. There are some pitfalls in the implementation, such as timeouts for longer inactivity or unhandled exceptions that cause channel violation.

+3
source

All Articles