0

For a new interface on our application I decided that it was necessary to forego websockets and choose comet for its much-wider support. I realized there are several techniques, and I need to ensure I choose the right one.

The question: Does the AJAX polling method release chunked data as soon as it's received or wait until the request closes?

If not, is there a way to use the iFrame technique and eliminate the browser spinner of death?

Thanks!

crockpotveggies
  • 12,682
  • 12
  • 70
  • 140

3 Answers3

0

Comet through ajax (ajax long polling) only makes data available to the front end of the application after the request is complete. It's useful for when you have discrete packets of data that you need to send at irregular intervals. If you want to chunk your data, then simply finish the request after the first chunk and then have the client immediately ask for another chunk. If there's another chunk ready, serve that right away; if there isn't, then just make the client wait until there is.

Andrew Gorcester
  • 19,595
  • 7
  • 57
  • 73
0

It's probably worthwhile noting that HTTP Long-Polling and HTTP Streaming both fall under the Comet umbrella. Long-Polling requires the connection to be closed to send the data. Streaming does not and can send the data over the existing connection without closing it.

I don't believe there is an easy way of solving the 'spinner of death' problem. I wrote a post about this a number of years ago and I still don't know of a fool proof solution.

Personally, I'd recommend you look at using WebSockets rather than hacky Comet solutions.

Comet is about the past. Lets make the future real.

- Alex Russell, inventor of Comet

leggetter
  • 15,248
  • 1
  • 55
  • 61
  • thanks for the links! actually i already use websockets and i love 'em. unfortunately, this particular interface needs to be universally-supported and is public-facing (unlike our other software). thus, android browser or blackberry would have a hard time with it ;) – crockpotveggies Jul 10 '12 at 01:16
0

Release of the data.... Whether it is chunked or not, it can be flushed to the stream and accessible from the client side (IE may act differently)

If you control the size of the stream from the other side of the pipe (server) I don't see any risk here. Maybe you need to benefit from one of the current solutions. If you need a solution for enterprise reasons try PokeIn , or if just hanging around, SignalR is free