I have a page, the contents are gotten dynamically with php and Mysql.I use a foreach loop to display all the content.
foreach($data as $key){
echo "<div id="post_content"> $key['post'] </div>";
}
Now I get my feed just as it is, but the problem here is, the page needs to be refreshed before you see new post rows from the database. This is where twitter comes in, when you're on twitter and there's a new post from someone you are following, it shows "1 new tweet" at the top of the feed, when you click this it adds the content of the tweet to the feed. From my research, i've found a couple of ways to do this;
Websockets. Cons: Cross browser compatibility.
Using AJAX:
refresh = setInterval(function(), 5000);
Cons: Well, loading a script every 5 second :/- Someone recomended socket.io to me and i'm still looking at how to integrate it with php.
My questions is, is there any other effective(prefarably simple and effecient) way of doing this? Any help would be greatly appreciated.