AJAX Polling Frequency - To long poll or not to long poll?
问题 I'm building a component of a web page that needs relatively constant database polling. I can see two different approaches for this, and I'm wondering if one of them is better than the others, or if I'm missing a third option. 1) Send off an AJAX request every 1 or 2 seconds to check for updates. Each request returns immediately whether or not there is new data. 2) Fire off a single AJAX request that will not return until it receives data or a timeout occurs. Upon either of those happening,