News for hackers. Stuff that matters.
Re:Show HN: HNLive – Hacker News in Real Time by lambdacomplete on Thursday January 21, 2016 @08:56PM (#10950221)
Not really "real time". See [2] (quoted below).

`function update() { $("#live").load("/get_links/hot"); } setInterval(update, 10000);update();`

Polling per se is ok but you should do it on the server and push to the client through web sockets or server-sent events [1].

Refs:

[1] https://developer.mozilla.org/en-US/docs/Web/API/Server-sent...

[2] https://github.com/Max00355/HNLive/blob/master/templates/new...

Re:Show HN: HNLive – Hacker News in Real Time by andrewstuart2 on Thursday January 21, 2016 @09:28PM (#10950369)
Especially when there's a fancy fully-real-time API provided for free by firebase. Not that it's the most efficient way to query all the top stories, but there's plenty that can be done with it.

https://hacker-news.firebaseio.com/v0/topstories

Re:Show HN: HNLive – Hacker News in Real Time by 2ton_jeff on Thursday January 21, 2016 @10:16PM (#10950530)
when I wrote hnwatch last year, there were some "issues" with the firebase feed, but for the most part the firebaseio goods are in fact realtime.
Re:Show HN: HNLive – Hacker News in Real Time by insin on Friday January 22, 2016 @07:09AM (#10952239)
It works pretty well, but there are still some "issues" you need to deal with:

- Items for users with a delay configured get posted to the API before their content is made available (if you go to the story id on HN proper, there's a * placeholder)

- The odd item will come back as `null` from the API for a while

As long as you deal going from not having content for an item to having content in an update, the API usually corrects itself eventually.

Here are live feeds of new stories and comments from the Firebase API in the client I wrote when it was announced:

http://insin.github.io/react-hn/#/newest

http://insin.github.io/react-hn/#/newcomments

Re:Show HN: HNLive – Hacker News in Real Time by vanous on Friday January 22, 2016 @05:04AM (#10951842)
Thanks for the links. Any experiences with practical deployment, the compatibility chart [1] shows minimal support for mobile browsers and no support for IE? I have several command line tools that i expose via internal web pages and ended up also using setInterval based polling, rather then server pushed messaging.

[1] https://developer.mozilla.org/en-US/docs/Web/API/EventSource...

Re:Show HN: HNLive – Hacker News in Real Time by dspillett on Friday January 22, 2016 @06:09AM (#10952051)
For supporting legacy browsers you need to fall back to polling unfortunately.

A better option than repeated requests every X seconds (or X times per second) is long polling (see https://en.wikipedia.org/wiki/Push_technology for brief notes and your preferred search engine for many examples). You can only do this if you control the back-end (so can dictate its API) or the API you are using explicitly supports long polling, of course.

There are a number of libraries out there that try to wrap the different methods into one so you don't have to worry about compatibility, using the more efficient websockets where possible, falling back to long-poll where not, and sometimes other methods in between (integrating a little bit of flash for instance). http://socket.io/ is probably the best know of these.

Re:Show HN: HNLive – Hacker News in Real Time by mchahn on Sunday January 24, 2016 @12:06AM (#10961543)
Server-sent-events are an often overlooked alternative to polling and websockets. They work on all browsers and I'm having good luck using them.
Re:Show HN: HNLive – Hacker News in Real Time by dspillett on Monday January 25, 2016 @04:25AM (#10966298)
I thought that got dropped from "HTML5" and was considered deprecated?

It was never implemented directly in IE or Edge (http://caniuse.com/#feat=eventsource), so when you say "work in all browsers" do you discount IE or can you recommend a good well-supported polyfill?

Re:Show HN: HNLive – Hacker News in Real Time by jondubois on Friday January 22, 2016 @06:56AM (#10952202)
No one cares about legacy browsers except you and your grandma ;p
Re:Show HN: HNLive – Hacker News in Real Time by dspillett on Monday January 25, 2016 @04:20AM (#10966288)
He specifically mentioned compatibility charts, which implies he isn't just looking at supporting the latest and greatest!

In my personal projects I don't care about legacy browsers (to users that far out of date I say "please go be a pain in the side for someone else"), but professionally I'll have to support at least as far back as IE8 for a while yet and I suspect a great many people are in the same position.

Re:Show HN: HNLive – Hacker News in Real Time by jondubois on Friday January 22, 2016 @06:54AM (#10952191)
I guess that explains why it's down right now :p
Re:Show HN: HNLive – Hacker News in Real Time by nine_k on Thursday January 21, 2016 @10:32PM (#10950577)
Look at http://www.hckrnews.com/ It does about the same thing. It is instructive to compare the two and understand one is more usable than the other.
Re:Show HN: HNLive – Hacker News in Real Time by kentosi on Thursday January 21, 2016 @09:14PM (#10950305)
Hi there I found a character rendering issue.

HN front page: "Why do people keep coming to this couple’s home ..."

HNLive front page: "Why do people keep coming to this couple’s home ..."

Re:Show HN: HNLive – Hacker News in Real Time by minimaxir on Thursday January 21, 2016 @10:13PM (#10950518)
If anyone is curious, this is a UTF-8 encoding error as HN automatically coverts normal quotes to smart quotes. Makes things annoying when scraping.
Re:Show HN: HNLive – Hacker News in Real Time by vinceyuan on Thursday January 21, 2016 @09:31PM (#10950383)
Suggestion: add links of comments. Many people like reading comments at Hacker News. Users have to open the original HN home page to open comments.

btw, I created another HN web client: Hacker News Room http://hackernewsroom.com

Re:Show HN: HNLive – Hacker News in Real Time by joshmn on Thursday January 21, 2016 @11:00PM (#10950670)
This guys submission history is littered with this thing.
Re:Show HN: HNLive – Hacker News in Real Time by chowes on Thursday January 21, 2016 @09:01PM (#10950254)
With HN data being provided by Firebase, why not leverage the realtime capabilities their service provides?
Re:Show HN: HNLive – Hacker News in Real Time by valentinvieriu on Sunday January 24, 2016 @04:43PM (#10964158)
I guess everybody has it's own clone. With Firebase opening up the dat, it's quite trivial to build your own Here is my version: https://hnews.xyz/#/ It grabs the preview of the landing pages so you kind of know what you are getting into
Re:Show HN: HNLive – Hacker News in Real Time by tagawa on Thursday January 21, 2016 @08:42PM (#10950160)
Nice. This would be good as part of a dashboard on a second monitor.

Request: I'd love to see domain names included. Submitter usernames would also be nice as long as it doesn't make it too cluttered.

Edit: I'd really like to be able to click through to the comments page as well. Speaking of which, are you sure those comment figures are correct?

Re:Show HN: HNLive – Hacker News in Real Time by japhyr on Thursday January 21, 2016 @09:09PM (#10950281)
This is great. When I go to the new page, one of the first things I look for is articles where a conversation is just starting. This makes it really easy to see which submissions are starting to get some attention.
Re:Show HN: HNLive – Hacker News in Real Time by dimfeld on Friday January 22, 2016 @09:27AM (#10952851)
Seems like the points and comments numbers are often inaccurate. Sometimes they're right but other times way off. Any idea what's happening there?
Re:Show HN: HNLive – Hacker News in Real Time by vaguilar on Thursday January 21, 2016 @09:00PM (#10950238)
Neat. Another issue along with the others mentioned is something is probably wrong with the text encoding. Some punctuation is displayed incorrectly.
Re:Show HN: HNLive – Hacker News in Real Time by heinrich5991 on Thursday January 21, 2016 @08:48PM (#10950188)
Typo: hacker hews (right in the subtitle)
Re:Show HN: HNLive – Hacker News in Real Time by jMyles on Thursday January 21, 2016 @08:40PM (#10950151)
What can you tell us about the stack powering this?

It's gunicorn; I was hoping to see hendrix. :-)

How are you doing the push?

Re:Show HN: HNLive – Hacker News in Real Time by Zyst on Thursday January 21, 2016 @09:38PM (#10950406)
It seems to be a jQuery bit of code querying the api every 10 seconds.

No push or anything of the sort, so that's a bit of a shame.

Re:Show HN: HNLive – Hacker News in Real Time by grouzen on Thursday January 21, 2016 @10:49PM (#10950636)
I have the same in my FB being subscribed to their facebook page.