2

How can I implement the comet / server push design pattern using PHP and Javascript? Essentially what I would like is something like this:

  • User clicks a 'submit' button
  • Javascript shows a message like 'Processing 0 / 100 items'
  • Whenever a new item is processed, the php / server pushes out an update, and the javascript changes the message to 'Processing 2/100 items, 3/100 items, and so on'.

How can I do this? Any links/info please?

Ali
  • 261,656
  • 265
  • 575
  • 769

3 Answers3

2

Comet with PHP has some tricky issues with scaling. An alternative would be a SaaS solution, such as WebSync On-Demand. (Disclaimer: I work there). That way you don't have to worry about any of the behind the scenes stuff, and you can just get your server-push functionality.

Jerod Venema
  • 44,124
  • 5
  • 66
  • 109
  • Not with the On-Demand version - it's SaaS, so it'll work with whatever you're using. For example, I do some of my tests on my personal page, which is running Apache (http://jerodandangela.com/fm-xd.htm) – Jerod Venema Jan 11 '10 at 16:27
1

There are a couple of very good examples at: How to implement comet with PHP

ConsultUtah
  • 6,639
  • 3
  • 32
  • 51
0

Most of the services use the Client-initiated requests, but there's also Comet. There's a few articles out there on it.

Agent_9191
  • 7,216
  • 5
  • 33
  • 57