How to stop Comet streaming message buffered in browser

I am trying to transfer data packets from my HTTP server to the browser using the "forever iframe" comet and feeding script tags from the server using the Transfer-Encoding: chunked header. I found that the script tags are not interpreted immediately, and I have to send some pieces before the browser starts responding to them. In the case of IE8, this seems to require something like 256 bytes of data (I just didn’t check it), and in Firefox 3.5.7, it looks like something more than a kilobyte. I have not yet been able to get Chrome to respond to script tags before the connection closes. However, in all cases, if I finish the broken data (with the fragment "0"), any buffered fragments are interpreted. I found a link for this behavior in Safari, but did not find such information for other browsers.

I would like to know how I can reliably execute these script tags as they are sent without any buffering mechanism slowing them down?

+4
source share
1 answer

Do you need to use forever iframe? If you use websockets and return to Flash xml sockets, you can support all the browsers currently in use (except, perhaps, on telephones) and get a real api socket.

+1
source

Source: https://habr.com/ru/post/1300452/


All Articles