All the clients can use jquery and send following request periodically:
function checkIfIAmInvited()
{
jQuery.ajax({
type: "POST",
url: "some.php",
data: "name=currentUser&",
success: function(msg){
if(msg.indexOf('uninvited') !== -1 )
{
alert( "You have been invited by " + msg );
//Method to do stuff once I am invited
iAmInvitedMethod();
}
});
}
To call above code periodically you can use following code in jquery/javascript. This would be making periodic calls and getting the response back to you. As soon as the response come without containing "uninvited" string it gives an alert and also calls the post method function.
This can be repeatedly called with following code.
window.setInterval("checkIfIAmInvited()", 5000);
This will check every 5 seconds if there are any invitations. Alternatively for a more better control jquery plugins like Timer can be used to execute something repeatedly.