I've noticed while browsing Stack Exchange that there are dynamic notifications like "3 new messages, click to show". I want to have this kind of dynamic updating for what I'm about to explain.
Let's say I want to create a carousel/slideshow of 10 recent news articles. I want this carousel to be updated hourly, in a queue. Newer articles will push older articles out of the queue. The solution off the top of my head would be.
- User logs on to client.
- Client calculates # of minutes until next hour mark and sets a timer to execute at the hour.
- At hour mark, send a request to the server about any new news articles that haven't been in the carousel already.
- Handle response.
- Reset timer.
Is this an acceptable strategy? Can I achieve this without relying on client requests? In other words how does Stack Exchange achieve its dynamic updating?