Server-Sent Events (SSE) are best for unidirectional communication where the server continuously sends data to the client, like live updates or notifications.
Accept: text/event-stream
on a regular GraphQL POST request. The document must be a subscription. Try out the following example:
EventSource
. Here’s a full example using JavaScript’s fetch
API with the ReadableStream
interface. You can also copy paste this example in the Developer Console to test it.
EventSource
is not very difficult to add, but we haven’t seen the need for it yet. If you require it, please open an issue in our repository.?wg_sse=true
to the end of your HTTP request). We will continue to support it for a short grace period.