DEV Community

Cover image for WebHook - An Introduction

WebHook - An Introduction

Johnson Ogwuru on August 10, 2019

Most folks hate being micro-managed, we mostly want to be allowed to do our best work and not to be constantly reminded of it, or being repeatedly ...
Collapse
 
erebos-manannan profile image
Erebos Manannán

Just to clarify a few things: You don't use WebHooks for "client side" events, i.e. browsers.

They are meant for server to server notifications, when your backend wants to be notified of payments from PayPal, or other such things.

For client notifications people typically use something like a WebSocket combined with a Pub/Sub (Publisher-Subscriber) system that can handle the distribution of events efficiently in near-realtime to connected clients.

Collapse
 
eimihar profile image
Rahimie Ahmad

Agreed. I think the article got it wrong when it starts to use long polling as comparison. As both websocket and webhook are totally different concepts.

Other than that, it's a good article about webhook (client-side part aside)

Collapse
 
ogwurujohnson profile image
Johnson Ogwuru

Thanks Rahimie

Collapse
 
ogwurujohnson profile image
Johnson Ogwuru

awesome, thanks for this feedback

Collapse
 
stewartjarod profile image
Jarod Stewart

I think you may want to revise your article based on this feedback. Or at minimum remove the use-cases that you've mentioned that are incorrect.

I have maintained, created, and consumed many webhooks and I can concur, you would not use them for web apps for notifications, new tweets/posts, etc.

For more information on a webhook, I like to point to an old post my friends at SendGrid wrote: sendgrid.com/blog/whats-webhook/

Best of luck and continued learning!

Collapse
 
hemantparashar profile image
Hemant Parashar

Webhooks aren't meant for client side and definitely cannot notify the client of an event using HTTP POST. There needs to be a request from a client in order to receive a response from an endpoint of any sorts. Untill and unless you're using websockets, you'll still need to poll an endpoint to get a response/status.

Collapse
 
subu profile image
Subramanya Shenoy

Just a quick question is it a alternative for service worker + periodic sync ?

Collapse
 
jeddevs profile image
Theo

An interesting read, certainly extended by understanding of webhooks, Thank you.

Collapse
 
ogwurujohnson profile image
Johnson Ogwuru

glad you enjoyed it Theo

Collapse
 
urielsouza29 profile image
Uriel dos Santos Souza

SSE server sent events server to clients
Webhook server to server!