public function disconnect() { JAXLLoop::unwatch($this->fd, array('read' => true, 'write' => true)); if (is_resource($this->fd)) { fclose($this->fd); } $this->fd = null; }