Is this PhP script a legitimate approach to long polling or is this to heavy on the server?
$FoundNewContent = false;
$tokens = array();
while(!$FoundNewContent) {
usleep(300000);
clearstatcache();
$SQL1 = "SELECT * FROM tokens WHERE ID > ".$_GET['tokenID'];
$result1 = mysql_query($SQL1);
while($row1 = mysql_fetch_array($result1, MYSQL_ASSOC)) {
array_push($tokens, $row1);
$FoundNewContent = true;
}
}
// Parse XML array
flush()
I am calling this script via Ajax.