Take advantage of ASP.Net Web Hooks to send HTTP POST notifications within the context of the ASP.Net runtime Essentially, WebHooks is a pattern — its implementation varies from service to service. However, the basic concepts are all the same: You leverage a publisher/subscriber model. When an event occurs, a notification is sent via HTTP POST over HTTP. ASP.Net WebHooks represent a lightweight pattern that provides support for a publisher/subscriber model over HTTP. The publisher/subscriber pattern is a messaging pattern in which the publishers are not programmed to send messages to specific subscribers, and the subscribers receive only those messages that they need or are relevant. This model providing increased scalability. ASP.Net WebHooks is an exciting new feature that has been added to the ASP.Net stack. ASP.Net WebHooks is open source and, as of this writing, is being actively developed. There are many online services that take advantage of WebHooks to notify actions. These include: GitHub, Trello, Dropbox, Salesforce, WordPress, and more. WebHooks are nothing new, but they are poised to be the technology of choice for building RESTful services that need to execute tasks and send notifications. MSDN states: WebHooks is a pattern which means that it varies how it is used from service to service but the basic idea is the same. You can think of WebHooks as a simple pub/sub model where a user can subscribe to events happening elsewhere. The event notifications are propagated as HTTP POST requests containing information about the event itself. How does it all work? When a WebHook is raised, here’s the sequence of steps that happen in a typical WebHook flow. The WebHook publisher first exposes events that can be subscribed to by the WebHook subscribers. The WebHook subscriber now subscribes to the WebHook. As and when an event occurs, HTTP POST callbacks are sent to the registered subscribers. The WebHook receiver then validates the request and, if all’s fine, it passes it to a WebHook handler. The WebHook handler then provides your application access to the data that has been received through the WebHook. Receivers and handlers Note that the two major concepts you should understand to work with WebHooks include receivers and handlers. While the former is responsible for accepting WebHooks and verifying their integrity, the latter is used to process a particular WebHook. WebHooks and SignalR ASP.Net WebHooks are used to send and receive hooks within the context of the ASP.Net engine. What’s the difference then between WebHooks and SignalR — are they both the same? Not really. WebHooks and SingalR can be complementary to each other. WebHooks is a technology that enables you to receive notifications via HTTP POST requests. Such notifications are pushed in real time without needing to hold the network connections open. In essence, there isn’t any need to hold connections open while waiting for events. SignalR is an open source library written in .Net and doesn’t leverage the request-response model to establish communications between the server and the client. Rather, it uses Remote Procedure Call (RPC) to enable the server-side application to notify the Web browser at the client side with updates and notifications. SignalR is an abstraction over a TCP connection. In essence, you can leverage SignalR for notifications within a .Net application through WebSockets. If your application receives a notification from Dropbox, you can notify a user of the application using SignalR or Web Sockets. Where do I get ASP.Net WebHooks? You can install ASP.Net WebHooks via NuGet Package Manager in Visual Studio. Alternatively, you can install the packages from Package Manager Console Window. All of these packages are grouped into Common, Sender, and Receiver categories. If you want to work with ASP.Net WebHooks, you must install the right WebHook provider. For each service from which you would like to receive WebHooks, you should install the corresponding provider. The NuGet packages in the Receiver category are named Microsoft.AspNet.WebHooks.Receivers.*. The * in the name implies the service you would like to connect to. For example, if you were to receive WebHooks from GitHub, you would need to install Microsoft.AspNet.WebHooks.Receivers.GitHub. Note: You should install Microsoft.AspNet.WebHooks.Receivers.Custom if you would like to receive WebHooks sent by ASP.Net WebHooks. You can find out more about ASP.Net WebHook from Microsoft’s documentation. I will post a series of articles on how we can program ASP.Net WebHooks soon. Related content feature 14 great preprocessors for developers who love to code Sometimes it seems like the rules of programming are designed to make coding a chore. Here are 14 ways preprocessors can help make software development fun again. By Peter Wayner Nov 18, 2024 10 mins Development Tools Software Development feature Designing the APIs that accidentally power businesses Well-designed APIs, even those often-neglected internal APIs, make developers more productive and businesses more agile. By Jean Yang Nov 18, 2024 6 mins APIs Software Development news Spin 3.0 supports polyglot development using Wasm components Fermyon’s open source framework for building server-side WebAssembly apps allows developers to compose apps from components created with different languages. By Paul Krill Nov 18, 2024 2 mins Microservices Serverless Computing Development Libraries and Frameworks news Go language evolving for future hardware, AI workloads The Go team is working to adapt Go to large multicore systems, the latest hardware instructions, and the needs of developers of large-scale AI systems. By Paul Krill Nov 15, 2024 3 mins Google Go Generative AI Programming Languages Resources Videos