You are viewing the preview version of this book
Click here for the full version.

Client-side

GraphQL offers to make things easier on the frontend. Most importantly, it reduces the number of requests by allowing specifying nested objects that eliminates the need for fetching different types of items. Then it defines a single way for real-time updates, so that a single implementation can process all the different types of pushed data. A frontend application makes one request on page load that returns all the data it needs, then subscribes to updates to the real-time channel that pushes data as it comes.

But this simplicity is true in simple cases only. Any real-world use-case will have difficulties that are challenging to solve properly.

In this chapter, we'll discuss the problems arise beyond the "Hello world". More specifically, we'll focus on two broader problem sets: how to implement queries that can handle pagination in an efficient way, and how to implement subscriptions so that the data shown to the user is reliably updated.