public function doEvents($timer = 1) { $loop = $this->getClient()->getLoop(); $looping = true; $loop->addTimer($timer, function () use(&$looping) { $looping = false; }); while ($looping) { usleep(1000); $loop->tick(); } }