Reputation: 2361
I have read http://en.wikipedia.org/wiki/Webhook but still i am not clear about webhook concept.
I have following doubts about webhook :
1.Can anyone explain what is the use of webhook with real world example?
2.Why should i use webhook in application?
Upvotes: 3
Views: 1237
Reputation: 5651
In simple terms webhooks are extension points which allow others to extend your application.
You will define webhooks (extensions points), users will register their functions with these hooks and whenever these extension points are reached your application will call users registered functions.
Upvotes: 1
Reputation: 6693
As alluded to in the Wikipedia article, an excellent real-world example is a source code repository like github. Suppose you're using github to manage your source, and a separate tool (bamboo, jenkins, whatever) to perform continuous integration. Every time you push code to github, you want it to trigger a build in your CI tool. How're we going to make that happen?
Given the topic, it shouldn't be surprising that the answer is 'webhooks'.
Github offers a variety of webhook triggers. See https://developer.github.com/webhooks/ for their documentation - the concrete example may help. In brief, however, each webhook consists of:
The important thing here is that github doesn't know what CI system you're using. It doesn't care. It knows about events that occur in its domain, and it's up to the outside system to register its interest and decide what to do with the notification. This creates a highly generic and scalable interface, and avoids requiring git to make any (potentially limiting) assumptions about who or what may want to react to its events.
Upvotes: 4