I am coding a website in PHP and Javascript which implements private messaging functionality, and i wanted to have it so when a user recieved a new message it notifies them (by a flashing 'mail' icon at the top of the screen).
The question is how to implement this functionality without having to check the messages database for unread messages to the specified user every time they load a page, it seems like too much server load for every user to perform on every pageload.
Can anybody suggest a more efficient method? It doesn't matter if the user isn't notified instantly upon recieving a new message.
Thanks!