从服务器检索网站的事件

I am building a website using Javascript and PHP. The website has events like receiving a message or receiving a challenge etc and also events that occur at a specific time like the challenge expiring.

I want the user to be notified of these events when they happen so what would be the best way to do this? Would it be javascript sending a request every second or so to check for events?

Thanks.

You want to look at websockets. A good way to do this in PHP is with a library called "Ratchet":

http://socketo.me/

Unfortunately websockets don't have very good cross-browser compatibility.