3 ms·
Conceptually, polling just seems dirty. if (some event occurred){ do something over and over every so often that requires multitudes of processes including aut
by damon_c 12y ago
Conceptually, polling just seems dirty.
if (some event occurred){
do something over and over every so often that requires multitudes of processes including authentication, DNS etc. across many machines, that might not even ever return any value to the user.
}
is not as nice as,
on('the arrival of a message', doSomething)
edit: pardon the sloppy pseudo syntax...
- YZF 12y agoagreed but "long polling" is not really polling because you're blocking on the HTTP request. Something over UDP sounds like the answer to the complaints about TCP connections getting dropped though. TCP was built for streaming...
- colanderman 12y agoTCP technically relies only on state on the endpoints, so it "should" never be dropped unless the endpoints agree. But NAT and various other interlopers ruin this model, as state is then kept in middle-boxes. UDP would evince the same problem when traversing NAT, since it also would require state to be kept in middle-boxes. The only difference is that instead of periodically reconnecting, you'd need to periodically ping.
- matt_kantor 12y agoWhy not server-sent events[0]? var source = new EventSource('/some/url/path'); source.onmessage = doSomething; [0] http://dev.w3.org/html5/eventsource/ http://dev.w3.org/html5/eventsource/