public function pause() { if (!$this->paused) { $this->paused = true; $this->listening = false; $this->loop->removeReadStream($this->resource); $this->loop->removeWriteStream($this->resource); } }