网站的实时通知

I'm not very good in php since I was making mobile app at first. So the problem is how could I make a real time notification like Facebook nowadays? I having quick much of researching regarding comet, polling , web socket, etc.

For web socket my server proxy do not allow me to do that.

For comet is that really using much resource? And I always have the problem with 500 server interval error even though i using set_time_limit(0). How what is the solution for this?

For polling no comments.

So what is the best solution?

I think the best solution for you is yousing ajax. You can create function which with ajax get all notifications from php and then with setInterval repeat this function maybe ebry second!

For real-time notification system you might want to use Web Sockets

This link might help you for PHP.

For any simple real time notifiaction you can use ajax auto refresh DIV

your include.php file will run every 5 second

<script type="text/javascript">
var auto_refresh = setInterval(
function ()
{
$('#load_tweets').load('include.php').fadeIn("slow");
}, 5000); // refresh every 50000 milliseconds
</script>


<div id="load_tweets"  > </div>