I was wondering if there was a way too start a timer from an WampServerInterface instance?
I saw that you can set it on the server object. But I need to create it from my WanpServerInterface object if somebody subscribe to a certain event.
Any toughts?
Regards,
Timer is a function on the loop object so it can be called by getting the loop object. But as the documentation is really minimalistic, it took me sometime to find the answer (couple of hours and more)and get back here.
class MyObject implements WampServerInterface
{
...
$this->loop->addPeriodicTimer(2, function($timer) { call_user_func(array($this, 'startCountdown'), $timer); }) ;
...
}