/** * @param Topic $topic * * @return array */ public function registerPeriodicTimer(Topic $topic) { //add $this->periodicTimer->addPeriodicTimer($this, 'hello', 5, function () use($topic) { $topic->broadcast(['msg' => "ellooooo"]); }); //exist $this->periodicTimer->isPeriodicTimerActive($this, 'hello'); // true or false //remove $this->periodicTimer->cancelPeriodicTimer($this, 'hello'); }