What's the difference between webhook and sending an HTTP request to an endpoint exposed by client
Hi I'm learning about building web api at the moment. Came across this concept called webhook and is now confused.
What's the difference between webhook and sending an HTTP request to an endpoint exposed by client?
Theoretically I can keep a list of client endpoints and their interested events in the databse. When an event happens (eg. placing down an order), I can just send a HTTP request to all the clients that subscribe to this event. Why on earth do I need a webhook?
4 Replies
So... you'll be sending a webhook, then
Webhooks are nothing super special
If my application does something, and you want your application to be notified with it's done, you give my application a URL it should call, and my application will call it when needed
That's all a webhook is
@ZZZZZZZZZZZZZZZZZZZZZZZZZ Would it be correct to say webhook is basically a callback for when something happens. And that it only exist for system to system communication? Since end users don't have api endpoints. For real time updates between end users and servers, we should use WebSocket instead.
yeah
@ZZZZZZZZZZZZZZZZZZZZZZZZZ Thanks heaps! Cleared up my confusion!