CreateTimerListen.php 403 B

1234567891011121314151617181920212223
  1. <?php
  2. namespace ln\listens;
  3. use ln\interfaces\ListenerInterface;
  4. use Swoole\Process;
  5. use Swoole\Server;
  6. class CreateTimerListen implements ListenerInterface
  7. {
  8. public function handle($event): void
  9. {
  10. $process = new Process(function () {
  11. app()->event->trigger('create_timer');
  12. }, false, 0, true);
  13. app()->make(Server::class)->addProcess($process);
  14. }
  15. }