0

I have a website which have more than 1000 users. I want to update the content of my site in every 10 sec. Suppose if one user update anything in a table so it will reflect to other logged in user. But remember the user is ideal. He doesn't press refresh on his browser.

I think of applying auto-refresh in every 10 sec through jquery which call the ajax post and gets back the updated result. But with my approach if 1000 users are online so my server will be hit by 1000 times. I want some optimized way to do this. Any suggestions

user3124690
  • 413
  • 1
  • 12
  • 25
  • So basically you wan't to get information from the server without calling it? I hope you see that that is not possible. – RononDex Jan 28 '14 at 13:48
  • Ofcorse I know that I have to call the server, but I don't want to hit the server for 1000 times – user3124690 Jan 28 '14 at 15:46
  • You could cache it in a file then and request that file from the server. However you **HAVE** to hit the server, everything else is impossible and was what I meant with ***I hope you see that*** in my previous comment – RononDex Jan 28 '14 at 15:47

1 Answers1

1

Setup ajax push instead:

  1. have the browser invoke a remote function on load.
  2. Then on the server wait for an event (new information to send out) then return it to the browsers. This may be easiest with node.js.

You will have to handle connections dropping depending on the reliability you want to implement.

Here's a discussion of Ajax push with php: Ajax push system

Community
  • 1
  • 1
Riccardo Zorn
  • 5,590
  • 1
  • 20
  • 36