News for hackers. Stuff that matters.
Re:Go HTTP2 demo by nodesocket on Thursday March 05, 2015 @05:59PM (#9154489)
I didn't know that HTTP2 supports streaming data. How is this done? It is not a websocket connection.

   /clockstream streams the current time every second
And why does it require ~1KB of junk to force browsers to start rendering immediately?
Re:Go HTTP2 demo by donatj on Thursday March 05, 2015 @06:16PM (#9154583)
You can do this with HTTP1 actually. Its how motion jpeg works. I've actually got a little mjpeg php script here - https://github.com/donatj/mjpeg-php/blob/master/mjpeg.php Just flush every frame and you're golden.

I've also seen simple dashboards that do this, displaying one line at a time as data comes in, simply never closing the connection.

Re:Go HTTP2 demo by shurcooL on Thursday March 05, 2015 @06:08PM (#9154529)
Some browsers will try to guess the content type from first few bytes, so they won't start showing anything until enough bytes have been received.

Well behaved browsers should not do that if Content-Type header is set.

Re:Go HTTP2 demo by pests on Thursday March 05, 2015 @06:11PM (#9154542)
I thought this has something to do with browsers returning their own internal 404 page if the content was less than 1kb? Something to do with that being the max size of error pages on old webservers, which browsers wanted to replace.
Re:Go HTTP2 demo by thekos on Friday March 06, 2015 @04:54AM (#9156375)
Re:Go HTTP2 demo by pests on Friday March 06, 2015 @09:20PM (#9160702)
Thanks! I knew I read about that years and years ago but wasn't sure if it was still true.
Re:Go HTTP2 demo by rakoo on Friday March 06, 2015 @07:56AM (#9156777)
> I didn't know that HTTP2 supports streaming data

It's not specific to HTTP2, and is in fact possible since the server doesn't send a Content-Length so the client doesn't know when the server is done. Think of it not as streaming, but as a really slow and consistent huge response. HTTP2 just makes it smoother (remember: HTTP2 doesn't change semantics, it only changes how things are represented on the wire)

Now, the way the demo server uses that is a bit rough; there is a specification for that in the form of Server-Sent events (https://developer.mozilla.org/en-US/docs/Server-sent_events/...).

Re:Go HTTP2 demo by staunch on Thursday March 05, 2015 @07:08PM (#9154795)