Does anyone know if there is a way for me to find out if they are playing a facebook application in real-time as in if they leave the page their facebook status message gets changed back to what it was when they began to play the game?

I am developing an application for facebook and not sure how to go about it

if you know how i can achieve this please tell,