News for hackers. Stuff that matters.
Re:Real-time updates without JavaScript by thesandlord on Tuesday February 06, 2018 @04:12PM (#16319756)
This is a really cool hack. Is the source code available somewhere? I understand how the updates are showing up in my browser (using CSS ::before and never closing the connection), but can't figure out how the post works without refreshing the page. Can't view source because the page never actually finishes returning. I'm probably forgetting something basic.
Re:Real-time updates without JavaScript by wybiral on Tuesday February 06, 2018 @04:21PM (#16319869)
The POST requests do refresh the page for the poster. But not for the viewers. For everyone else it just streams the HTML to them using chunked encoding.

It's written in Golang and hosted on a free Heroku instance. I'll probably upload the code somewhere after a bit.

Re:Real-time updates without JavaScript by thesandlord on Tuesday February 06, 2018 @04:41PM (#16320104)
Oh wow, I couldn't really notice the page refreshing at all... Nice job.
Re:Real-time updates without JavaScript by wybiral on Tuesday February 06, 2018 @05:07PM (#16320365)
Thanks. There's a subtle trick where new comments (from streamed updates) have a CSS animation but comments from the page reload don't. It seems to make it feel more seamless.
Re:Real-time updates without JavaScript by Felk on Tuesday February 06, 2018 @04:19PM (#16319846)
You're forgetting about F12 :)