Notifications and live updates - are websockets the best way to do it?

I am adding notifications and live updates to my react app. I currently use react query for server state management on the frontend and mongo + mongo app services (realm) for the backend. Have setup an api that the client can subscribe to and thinking of following what TkDodo has mentioned in his blog post https://tkdodo.eu/blog/using-web-sockets-with-react-query. Is this the best way to do it or would you recommend something else?
2 Replies
Leonidas
Leonidas3y ago
Depends on the quantity of updates you want to send. For low quantity updates http long polling should be the simplest but reliably working way. For high traffic updates a own notification service should be used like AWS SNS. Web sockets cannot be deployed under the serverless software architecture Not saying websockets are inherently bad, just not made for serverless infra (stateless servers)
Leonidas
Leonidas3y ago
https://pusher.com/ another popular notification service
Pusher | Leader In Realtime Technologies
Simple, scalable and reliable. Hosted realtime APIs loved by developers and trusted by giants. Build live dashboards, notifications, geotracking, chat and more.
Want results from more Discord servers?
Add your server