in reply to HTML5, SSE, flush output '$| = 1' not working as expected

Can you elaborate a bit on "it works in general..." What do you expect and what is actually happening?

  • Comment on Re: HTML5, SSE, flush output '$| = 1' not working as expected

Replies are listed 'Best First'.
Re^2: HTML5, SSE, flush output '$| = 1' not working as expected
by ehaase (Initiate) on Sep 04, 2015 at 14:18 UTC

    'In general' means, that the tickers are sent to the client and the client (Browser) receives the data. But all single updates are shown together at the end of the scripts instead of flushing each single ticker. The expected result is an update every second of one of the ticker symbols.

      Try printing headers using CGI, for example

      use CGI qw//; my $q = CGI->new(); print $q->header( -nph => 0, 'Content-Type' => ' text/event-stream', 'Cache-Control' => 'no-cache', 'Connection' => ' keep-alive', ); print $q->header( -nph => 1, 'Content-Type' => ' text/event-stream', 'Cache-Control' => 'no-cache', 'Connection' => ' keep-alive', ); __END__ Cache-control: no-cache Connection: keep-alive Content-Type: text/event-stream; charset=ISO-8859-1 HTTP/1.0 200 OK Server: cmdline Date: Fri, 04 Sep 2015 23:33:29 GMT Cache-control: no-cache Connection: keep-alive Content-Type: text/event-stream; charset=ISO-8859-1

      Do you see the difference? Without nph off, apache is going to fill in the missing headers

      With nph on, apache is not touching the headers .... and probably not buffering

        Were you able to get this resolved?