Chapter 10: Real-Time Subscriptions

The GraphQL application programming interface (API) we have built is very advanced, as is the frontend. In the previous chapter, we introduced server-side rendering (SSR) to our application. We provided the user with a lot of information through the news feed, chats, and profile pages. The problem we are facing now, however, is that the user currently has to either refresh the browser or we have set a pollInterval property to Apollo Hooks to keep the display up to date. A better solution is to implement Apollo subscriptions through WebSockets. This allows us to refresh the user interface (UI) of the user with the newest user information in real time without manual user interaction or polling.

This chapter ...

Get Full-Stack Web Development with GraphQL and React - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.