You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hey,
I have created a Leaderboard with Next.js for a game that I have created. Whenever somebody plays the game, a new score is sent to the database. My Leaderboard app is fetching the scores every 10 seconds from that database so that I always have the new scores displayed on that board.
However, I was asking myself how sustainable that is. I feel like all these fetches cause a lot of traffic. Thats why I thought it would be better to use websockets to emit a "newScore" event every time a new score was posted, so that the clients refresh their leaderboard. Unfortunately, next.js/vercels serverless functions don't seem to support websockets...
I'm not sure what to do to have a feel of "real-time" refresh of the leaderboard without making so many fetch requests to the database.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hey,
I have created a Leaderboard with Next.js for a game that I have created. Whenever somebody plays the game, a new score is sent to the database. My Leaderboard app is fetching the scores every 10 seconds from that database so that I always have the new scores displayed on that board.
However, I was asking myself how sustainable that is. I feel like all these fetches cause a lot of traffic. Thats why I thought it would be better to use websockets to emit a "newScore" event every time a new score was posted, so that the clients refresh their leaderboard. Unfortunately, next.js/vercels serverless functions don't seem to support websockets...
I'm not sure what to do to have a feel of "real-time" refresh of the leaderboard without making so many fetch requests to the database.
Thank you.
Beta Was this translation helpful? Give feedback.
All reactions