简体   繁体   中英

Publish/Subscribe Pattern in C# WCF

How to register client on server to listen some change? I want to notify my client and send some data when something changed on my server. Also, I use NetTcpBinding. I tried many examples, but I can't get method from server to register in. I don't have any config file.

Thanks in advance.

There is example of registering client on server.

ChannelFactory<ITrending> factory = new ChannelFactory<ITrending>(
            new NetTcpBinding(), new EndpointAddress(@"net.tcp://localhost:6000/ITrending"));

        proxy = factory.CreateChannel();

You can use the CallBack functionality in WCF services , it can be used for sending the changes in any entity or object value. In this case, Client must act as a server and server as a Client to receive the updates based on the method in the Client which is receiving the changes. More detailed explanation : http://www.dotnetcurry.com/wcf/721/push-data-wcf-callback-service

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM