The basic patterns for realizing events with APIs are the interrupt pattern and the polling pattern.
In approaches with the interrupt pattern (e.g. HTTP Streaming, Server-Sent Events, WebSockets, WebSub, Webhooks or GraphQL), the client is notified by an external source when something interesting happens. The responsibility for event execution is with the external source.
In approaches with the polling pattern (e.g. Short Polling or Long Polling), the client needs to figure out when something interesting happens, so the complete responsibility for event execution is with the client.
How do we realize events in an API context? In the new Webhooks Book we study several approaches for realizing events, such as Polling, Long Polling, HTTP Streaming, Server-Sent Events, WebSockets, WebSub, Webhooks and GraphQL Subscriptions.