PHPDaemon\Examples\GameMonitorHTTPRequest::init PHP Метод

init() публичный Метод

Constructor.
public init ( ) : void
Результат void
    public function init()
    {
        $req = $this;
        $job = $this->job = new \PHPDaemon\Core\ComplexJob(function () use($req) {
            // called when job is done
            $req->wakeup();
            // wake up the request immediately
        });
        $job('getServers', function ($name, $job) use($req) {
            // registering job named 'pingjob'
            $req->appInstance->servers->find(function ($cursor) use($name, $job) {
                $job->setResult($name, $cursor->items);
            });
        });
        $job();
        // let the fun begin
        $this->sleep(5);
        // setting timeout
    }
GameMonitorHTTPRequest