Skip to main content
Question Protected by gnat
Tweeted twitter.com/StackSoftEng/status/967111725462978566
deleted 12 characters in body
Source Link
user22815
user22815

I've noticed while browsing stack overflowStack 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'mI'm about to explain.

Let's say iI 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.

  1. User logs on to client.
  2. Client calculates # of minutes until next hour mark and sets a timer to execute at the hour.
  3. At hour mark, send a request to the server about any new news articles that haven't been in the carousel already.
  4. Handle response.
  5. Reset timer.

Is this an acceptable strategy? Can I achieve this without relying on client requests? In other words how does stack overflowStack Exchange achieve it'sits dynamic updating?

Thanks.

I've noticed while browsing stack overflow 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.

  1. User logs on to client.
  2. Client calculates # of minutes until next hour mark and sets a timer to execute at the hour.
  3. At hour mark, send a request to the server about any new news articles that haven't been in the carousel already.
  4. Handle response.
  5. Reset timer.

Is this an acceptable strategy? Can I achieve this without relying on client requests? In other words how does stack overflow achieve it's dynamic updating?

Thanks.

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.

  1. User logs on to client.
  2. Client calculates # of minutes until next hour mark and sets a timer to execute at the hour.
  3. At hour mark, send a request to the server about any new news articles that haven't been in the carousel already.
  4. Handle response.
  5. 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?

Source Link
Eric Guan
  • 325
  • 1
  • 2
  • 7

Pushing data from Server to Client without a client request?

I've noticed while browsing stack overflow 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.

  1. User logs on to client.
  2. Client calculates # of minutes until next hour mark and sets a timer to execute at the hour.
  3. At hour mark, send a request to the server about any new news articles that haven't been in the carousel already.
  4. Handle response.
  5. Reset timer.

Is this an acceptable strategy? Can I achieve this without relying on client requests? In other words how does stack overflow achieve it's dynamic updating?

Thanks.