educative.io

Educative

Difference between webhooks and Server-sent events

Webhooks sound very similar to the Server-sent events described previously in this course. Could you explain the difference between the two?

Hey @Romain

Some of the major differences are:

  • Webhooks requires a server-side subscription, which means that an HTTPS endpoint is required to create the subscription, whereas, Server-Sent-Events subscriptions can be created on the client-side.
  • WebSockets are bidirectional (allows communication between the client and the server) whereas Server-Sent-Events are mono-directional (only allows the client to receive data from the server).

Happy learning,

@Romain Server-sent events are a stream of events in just one direction - From the server to the client after an initial connection is established.

Web-hooks are bi-directional. Also, they don’t run over HTTP.