0

I've read and done (for my self) How do I implement basic "Long Polling"?

But why is this called "long-polling", It just polls when it's done on both success and error.

Community
  • 1
  • 1
Jason94
  • 13,320
  • 37
  • 106
  • 184

1 Answers1

2

A normal poll asks once in a very quick back and forth between client and server.

A long poll is kept open and idle for a long time, possibly sending data several times while the connection is open. Hence long polling.

deceze
  • 510,633
  • 85
  • 743
  • 889
  • wow. thanks. but could you give an example on how I'm able to send several times? this i don't understand – Jason94 Aug 05 '11 at 08:05
  • @Jason The server stays in an infinite loop, which keeps the connection open. The server simply writes output every once in a while. For example: `while (true) { echo 'foo'; sleep(1000); }` The client can read this data as it comes in. That's a real long poll. – deceze Aug 05 '11 at 08:14