Poll against subscription in Apollo Client?

I am creating a social site. When a user updates or creates new content on a site, I need other users browsing the site to see the change update.

I have comments that require low latency, so a subscription is recommended for this.

I also have events, but they do not need such a low delay. An update every 10 seconds would be nice. Should I also subscribe to this subscription for users, or if the survey will be less expensive for the server?

+4
source share
1 answer

For this purpose, a subscription was specially made, this is the best option, because the server only updates the response when necessary. However, if you use another option, you will constantly try to update the data, and you will spend resources from your server. I hope I helped.

Read more about this here: https://github.com/apollographql/apollo-client/blob/master/docs/source/features/subscriptions.md#when-to-use-subscriptions

+2
source

Source: https://habr.com/ru/post/1692894/


All Articles