MSDN article
Such method invokes an operation on a WCF service, but it does not expect a reply (something similar to an UDP transmission or a ::PostMessage call in Win32 API).
This type of contract can be used to publish notifications to subscribers.

One-way contracts can be used in duplex contracts, allowing clients and servers to be able to initiate calls to each other (peer communication).

Note: the article states that a server can make one-way calls to the client and the client can treat them as events. In the real world such a design will suffer greatly from the firewalls configurations. Only the new WebSockets-based channels will really easily support such scenarios. If you do not have the possibility to use a WebSocket channel yet, you will have to use long-polling channels to detect server notifications/events.


[ServiceContract(Namespace("http://www.3DOffice.ro/Services/BusinessTravelLog")]
public interface ITravelLog
{
[OperationContract( IsOneWay=true)]
void ReportLocation( double latitude, double longitude, DateTime localTime );
}

To consume (or access) a one-way service over HTTP, unfortunately the client must be aware of the transport. This is because HTTP is a request/response protocol.
When the one-way operation is called, the server returns a HTTP 202 (the request has been accepted, but the processing has not been completed). To avoid blocking the client, the server must either be “per-call” and have concurrency mode set to Multiple, either ensure the processing for one event requires a very short amount of time (for example, by using a DPC pattern).

Advertisements