/** * Close the stream and remove its all listeners & handlers * * @return this */ public function close() { $this->emit('close', array($this)); $this->data = ""; $this->type = -1; $this->closed = true; $this->ioloop->remove($this->stream); $this->removeAllListeners(); is_resource($this->stream) && fclose($this->stream); return $this; }