I need a way for clients (C# applications) of a ASP.NET Web API to be notified of certain changes via the Web API. They don't even need to know what the changes are, just need to get a notification that something changed (at that point it's up to the client to call the API to get any specific data they may need after getting the notification). I'm not sure what a good way of accomplishing this would look like.
I'm thinking one way might be to create events and somehow have the client subscribe to those events, but I don't know how to do that through Web API.
I found some mentions of SignalR on Google, but this seems like a lot of work to implement and seems to do a lot more than I need.
All I need is for the Web API to be able to tell the client "something changed, come and get it". However, I want to avoid polling. What is the fastest/easiest way to do accomplish this?
You really have only two options:
Web API is stateless by design. The API doesn't maintain any kind of connection or state information with any of the client applications. Therefore there's really no way to implement anything like a traditional C# event.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With