Multipart HTTP Requests
Multipart HTTP Protocol is a method for delivering incremental responses over HTTP. It allows you to receive subscription responses in clearly defined chunks, keeping an open connection throughout.
This multipart protocol is built on the Incremental Delivery over HTTP spec. The protocol delivers continuous updates in the format:
You can use multipart messages by setting Accept: multipart/mixed
on a GraphQL subscription POST request. Try out the following example:
Example
Client Integration
To implement Server-Sent Events (SSE) with a GraphQL POST request, you'll typically need to use a more custom approach than the standard 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.
This code doesn't handle connection issues and retries.
Last updated
Was this helpful?