addWriteStream() public method

Register a listener to be notified when a stream is ready to write.
public addWriteStream ( resource $stream, callable $listener )
$stream resource
$listener callable
Example #1
0
 /**
  * Send message.
  *
  * @param string $message
  * @return bool
  */
 public function send($message)
 {
     if ($this->closed) {
         return false;
     }
     $this->messages[] = $message;
     if (!$this->listening) {
         $this->listening = true;
         $this->loop->addWriteStream($this->fd, $this->writeListener);
     }
     return true;
 }
Example #2
0
 /**
  * @override
  * @inheritDoc
  */
 public function addWriteStream($stream, callable $listener)
 {
     $this->loop->addWriteStream($stream, $listener);
 }