Editorial Notes
This article starts with Preview of Microsoft ASP.NET WebHook and needs update time-to-time. It would contain reference links for further discussion or clarifications. This is an ongoing article and needs lot of upcoming updates.
There was an announcement for 'Microsoft ASP.NET WebHooks Preview
' on September 04, 2015
, where Henrik F Nielsen announced the release of 'Microsoft ASP.NET WebHooks Preview' as a new member of ASP.NET family.
For more information regarding this announcement, please refer to:
In this article, we will discuss about ASP.NET WebHook-Preview
.
Through-out this article, we will discuss about WebHooks, implementation with very first preview release of 'Microsoft ASP.NET WebHooks Preview'.
Currently, 'Microsoft ASP.NET WebHooks Preview
' is not finalized for release and in the stage where developer can try to use the magic of WebHooks in their code. In this article we will discuss more about this new member of ASP.NET family and try to understand the power of WebHooks using a simple program.
There is no such major things required to start with WebHooks, we just need to know:
- Basics of Services (Web APIs etc.)
- Visual Studio 2013 or later
- Basic knowledge of ASP.NET
To understand, first think about a scenario, where we need to perform some action on the output/result of an existing action.
We can also consider callback in C#, where we are performing few custom actions on results. Its not wrong if I say Program-A
automatically trigered with an input of output from ProgramA
.
In simple words, we can say WebHooks
are program/methods/functions/piece-of-code, which modified the actual behavior of a Web page, application, Resource etc.
The interesting thing is that these program/triggers can be/ can not be a part of actual WebSite, Web Application, where Program-A
belongs.
The term Web
reminds us to HTTP
. So, we can say that Webhooks
are nothing but just HTTP callback moreover these are user-defined HTTP Callback. In year 2007, term WebHook
came to announce, when Jeff Lindsay take it from Hook
.
WebHooks:
WebHook is a lightweight HTTP pattern providing a simple pub/sub model for wiring together Web APIs and SaaS services. When an event happens in a service, a notification is sent in the form of an HTTP POST request to registered subscribers. The POST request contains information about the event which makes it possible for the receiver to act accordingly.
We have lot of examples in our day-to-day life, might be we missed these:
- Checking-in/pushing a code into repository.
- Trigring deployment build.
- Posting comments on your favorite blogs.
- Post Trackback.
Think a scenario of a factory, which uses a crude oild as a raw material. There is a huge consumption of this oil in the factory on daily basis. They have three mark to maintain the oil storage/stock level in the factory.
Red
for lowest stock and denotes stop usage.
Yellow
for in stock and denotes can use.
Green
for lower stock and denotes order to purchase more.
Think a scenario, where factory workers/store-keepers or field-supervisors are maintaining numerous records for the stock of this oil. You can think how much complex this in real scenario?
In normal scenario, where the consumption of this crude oil is not so much and can esialy be maintained by manual interventions/activities. Unfortunately, in our case it is not so much simpler to take a byte of brea with Tea.
Here, we need skilled workers to maintain records and set the indicators accordingly so, related actiona can be taken. Think, how much time, cost and manpower would be required in this scenario. Isn't it good to automate it?
There might be many solutions we can think over. But here are the possible solutions:
- Make this process automate
- Write a short program/app to maintain the difference stock level
- Automate process so, related person get notified for action(s)
In all of above solutions, we need to trigger some action on the output of a particular action or taks. Isn't it relate to WebHook
?
In my personal opinion, I should suggest to do something like this:
- Write a program/app, which maintain the stock time-to-time (on/when action required)
- And notify the Panel-section to alarm
Red
, Yellow
or Green
indicators
With this solution as soon as there is any addition/substraction in the quantity of Crude-oil our program notify our Stock-Panel (which is nothing but similar to Traffic control light) and it trigers accordingly.
This is nothing but a publish-scubscribe pattern/model - a messaging pattern. We can assume this as a message-queue paradigm too. We are not geeting in more depth for pub/sub model, please refer to below link for further details:
Term WebHook
is not new (already discussed above it is coined in 2007) in the world of Web. There are lot of applications already provide, support WebHook
, followings are fewer name:
- Dropbox
- GitHub
- Trello
- Zendesk
- PayPal
- SalesForce
- Wordpress
There is nothing much change in Microsoft ASP.NET WebHook Preview
, it maintains the same publish-subscribe
model/pattern as we discussed above.
In other words, we can say that ASP.NET WebHook
does both send and receive Hook
as/within ASP.NET application/program. It has two sides:
Refer: http://blogs.msdn.com/b/webdev/archive/2015/09/04/introducing-microsoft-asp-net-webhooks-preview.aspx
Follow these simple step(s)
- Choose your package app for which you wnat to use WebHooks viz. Github, Trello, DropBox etc.
- Install from Preview Nuget eg. GitHub
- Alternatively, you can visit GitHub
Microsoft ASP.NET WebHook Preview provides us a facility to communicate outside without intervention of our internal implementation of ASP.NET application.
- Initial version on
September 09, 2015