Beispiel #1
0
 /**
  * Write specified $dataToWrite to the $socket destination stream
  *
  * @param \Alert\Reactor $reactor
  * @param resource $socket
  * @param string $dataToWrite
  * @return \After\Promise
  */
 public function write(Reactor $reactor, $socket, $dataToWrite)
 {
     $this->reactor = $reactor;
     $this->future = new Future();
     $this->socket = $socket;
     $this->buffer = $dataToWrite;
     $reactor->immediately(function () {
         $this->doWrite();
     });
     return $this->future->promise();
 }
Beispiel #2
0
 /**
  * Instruct a running event loop to stop.
  */
 public function stop()
 {
     $this->reactor->stop();
 }