4

I would like to start implementing to my site some "long polling like" techniques.

Basically i need a main feature that refresh an HTML listing whether new data has been added to the DB.

For my setup, I have a entry range VPS server with LAMP environement. I know PHP, JS and i am familiar with Unix systems.

What would be the right technology to achieve some long polling effects?

Thanks a lot for any inputs

silkAdmin
  • 4,640
  • 10
  • 52
  • 83

1 Answers1

6

One solution is to socket.io which is based on node.js and makes it super easy to use web-sockets and long polling for real-time updates. You will have to use JavaScript though for the server-side, but it sounds like you're okay with doing that.

Some related articles and discussions:

Community
  • 1
  • 1
Jamund Ferguson
  • 16,721
  • 3
  • 42
  • 50
  • How many concurrent connections/polls can this support? I have an experimental web-app that uses PHP and MySQL with an endless PHP while loop that sits and waits 30" for new data from the DB. But if you open up more than 25-30 requests it crashes the server. From what I understand using my process is that the PHP script (loop) uses a lot of resources without releasing them, since after 30 seconds the loop restarts. Can I achieve this functionality using Node or socket.io? – droplet Mar 29 '13 at 12:24
  • 1
    With node and socket.io it looks like around 2000 requests at the same time should be fine on a laptop-based server :) http://stackoverflow.com/questions/9924822/scalability-issues-relating-to-socket-io – Jamund Ferguson Mar 29 '13 at 14:22
  • So I'm guessing that a VPS or a dedicated machine should perform much better? – droplet Mar 30 '13 at 00:26
  • Presumably it could go much much higher. If you have trouble scaling you can always try something like http://www.pubnub.com/ which will handle the scaling for $$$ – Jamund Ferguson Mar 30 '13 at 00:35