Comet Streaming: Are XHR Streaming and Forever iFrame Still Possible in 2015?

I know I should probably be using WebSockets or Server-Side Events, but what happened to the Comet Streaming technologies that involved recording data from the server to iFrame

or as a response to xmlHttpRequest

? I've stumbled upon a few demos, but none of them work as intended, and since most of the stuff in this type of streaming is pretty old, I'm wondering if this can be done back in 2015?

Just to be clear, I am referring to the comet methods where the server keeps the connection open using encoded transmission coding, flushing new data on the fly. Staged rendering in browsers should presumably make this data available either in the case iFrame

(eg "Forever iFrame") or by reading a property on the responseText

object xmlHttpRequest

when it readyState

returns 3

(eg "XHR streaming"). However, all browsers seem to accumulate data until the connection is closed, no matter how much dummy preamble I add before sending the real data. Also, I am not referring to the special case with Content-Type

set inmultipart/x-mixed-replace

which only works in Firefox, but the approach that seems to have worked on most browsers a few years ago.

Does anyone know if the current browser behavior in these Comet streaming methods is out of date?

Examples of demos:

Polling responseText

when loading through an object xmlHttpRequest

:

http://ajaxify.com/run/streaming/xmlHttpRequest/countdown/ http://ajaxify.com/run/streaming/xmlHttpRequest/

Slow loading normal page, incremental rendering does NOT click me:

http://ajaxify.com/run/streaming/

iFrame

Slow loading content polling iFrame

:

http://ajaxify.com/run/streaming/xmlHttpRequest/iframe/

These demos do not use encoded transmission, but the result is the same, i.e. no incremental rendering occurs.

An article on comet shower:

http://cometdaily.com/2007/11/05/the-forever-frame-technique/



Short version output:

All of Comet's methods still work, however, in my case the antivirus got caught in an unforeseen path, so be sure to check things on different computers and in Safe Mode to make sure it doesn't work!

+3


source to share





All Articles