简体   繁体   中英

Can a WCF service use SignalR to notify clients of a change?

I have a mature client/service project that uses WCF services for the data access. These are called from a WPF client.

We now want to add notifications to the project, so have been looking at SignalR to push those notifications to the clients. This all works fine when it's SignalR itself that's initiating the push, say a client sends a SignalR notification to the server, the server can then notify all other clients.

However, as all of our data access is done via the WCF services, I want to be able to send out a SignalR notification in response to a WCF service call. For example, a client calls the UpdateCustomer() service call, which saves the modified customer data to the database. I then want to notify all other clients of the change. However, at this stage I'm in the WCF service code, not the SignalR code.

How do I tell SignalR to send out a notification?

Ah, found it just after posting!

Predictably, it was in the SignalR docs, How to call client methods and manage groups from outside the Hub class .

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