It’s real time of course.
A script (Ajax) looks for new messages every x seconds (x varies according to various situations). If there is a new message the script loads it.
If User is not connected an email is sent.
I guess it could be better with some sever side library but it works fine this way.