Transports & Subscriptions
Transport-agnostic on paper and almost always HTTP plus a socket in practice. Subscriptions are the part the specification leaves to the implementer, which is exactly why interviewers push on them.
part ofGraphQLoverview, primer and where to startread it →on this pageshowhide
explore
- GraphQL over HTTP4 questions
- Media Types & Status Codes3 questions
- Incremental Delivery Transport3 questions
- Subscription Message Flow4 questions
- WebSocket Subprotocol Negotiation3 questions
- Subscriptions over SSE3 questions
- Delivery Semantics & Resume4 questions
- Scaling Subscription Fan-Out4 questions
- File Uploads3 questions
- Multi-Operation Requests4 questions
questions
page 2 of 2Why does the graphql-ws subprotocol define its own ping and pong JSON messages?
basics
~20 sBecause a browser's WebSocket API gives page JavaScript no way to send or observe the transport's own liveness probe. The subprotocol therefore defines ping and pong as ordinary JSON messages that either side may send, carrying no operation id.
When does splitting a GraphQL response with @defer actually improve what the user sees?
basics
~20 sOnly when the deferred part is measurably slower than the rest and the interface can render usefully without it. If the client blocks on the whole tree, or the slow field is what the screen exists to show, deferring adds payloads and merge logic and moves nothing.
Your GraphQL server switches every response to application/graphql-response+json. What breaks, and how does Accept let you stage it?
basics
~20 sFailures that used to answer 200 start answering 4xx, so client and infrastructure code keyed on the status takes a different branch. The GraphQL over HTTP draft makes the choice Accept-driven, so a server answers the newer type only to clients that asked.
In a batched GraphQL request, why do per-operation caching and tracing stop working?
basics
~20 sBecause the unit the infrastructure sees is the batch, not the operation. One composite POST body means one cache key, one status, one access-log line and one span, so hit rates, error rates and latency can no longer be attributed to individual operations.
How do you budget capacity for a GraphQL subscription feature whose cost is events multiplied by subscribers?
basics
~20 sBudget in executions per second, not sockets: peak subscribers on the hottest single entity times that entity's event rate, times the CPU and backend calls one execution costs. Then decide whether the feature can afford that.
showing 31–35 of 35