Closed mgp25 closed 10 years ago
You only need to call SendPresenceSubscription once. Presence subscription is an async function which automatically notifies you when a user's presence changes:
$wa->SendPresenceSubscription($dst);
while(true){
$wa->PollMessages();
sleep(60);
}
@shirioko Yeah, i know, but it doesnt do anything, I tried that already :/ But it never notice me when the user goes online and that...
function onPresenceReceived($username, $from, $type)
{
echo "The user is now" . $type;
}
...
$wa->eventManager()->bind("onGetPresence", "onPresenceReceived");
$wa->SendPresenceSubscription($dst);
while(true){
sleep(60);
}
You're missing a space in
echo "The user is now" . $type;
@shirioko Right, but if i use:
echo "Test";
instead, still not work. Maybe the while interfere to display the text?
I think that the problem is inside into a while, because you make a sleep, the problem is in there...
I think is better try while (true){ limit(60); }
This method no make a pause in script... Or you can make a Ajax call from other page with interval that you want...
Saludos Jesús Sales
El 27/05/2014, a las 14:24, mgp25 notifications@github.com escribió:
@shirioko Right, but if i use:
echo "Test"; instead, still not work. Maybe the while interfere to display the text?
— Reply to this email directly or view it on GitHub.
@shirioko :+1: You are right :)
Hello, im trying to check the user online/offline status every minute. I have this code:
Note: I tried both onGetPresence and onPresence
I was testing with an active number, going online and offline, and nothing happened, this is the output, every 60 seconds:
It does not noticed me when the user went online or offline.
Any ideas?
Thanks :)