PHPDaemon\Examples\ExampleAsyncProcessRequest::init PHP Method

init() public method

Constructor.
public init ( ) : void
return void
    public function init()
    {
        $this->header('Content-Type: text/plain');
        $this->proc = new \PHPDaemon\Core\ShellCommand();
        $this->proc->onReadData(function ($stream, $data) {
            echo $data;
        });
        $this->proc->onEOF(function ($stream) {
            $this->wakeup();
        });
        $this->proc->nice(256);
        $this->proc->execute('/bin/ls -l /tmp');
    }
ExampleAsyncProcessRequest