Open scramatte opened 9 years ago
SendPresence and pollMessage in a while-loop.
My daemon runs for days without problems...
Von Samsung Mobile gesendet
@dennobaby, My bot works perfect. Can handle a lot of conversations during the day and for days. My doubt is, what the correct frequency of send of these commands? Today I sent pollMessage() every second and the sendPresence every ten seconds. It's okay, or need to be more slowly? It's only estetic, already works as is.
Can you post example code ?
@scramatte Well, I imaginated you already have a working code and have a main while as well, then you need to put the $w->sendPresence(); on this loop.
Just this ? ... I've just add it above pollMessage. I'm must wait now to see if it works or not. Thank you
$t=0; while (1) { $w->pollMessage(); $msgs = $w->getMessages(); foreach ($msgs as $m) { //do something }
if( ($t == 15)){
$w->sendPresence();
$t=0;
}
$t++;
}
Take a look to /test folder, whatsapp.php
Hi,
I've embed whatsapi into a php daemon. My issue is that I'm unable to keep online 24x7 the bot. After inactive time bot appears disconnected.
I'm running latest version. I've tried various thing such sendGetPrivacyBlockedList but still doesn't works. Does anybody has got a working example ?