/** * Graceful disconnect from the server * @param bool $sync * @return void */ public function disconnect($sync = false) { try { if ($this->connection && $this->connection->isConnected()) { if ($this->protocol) { $this->sendFrame($this->protocol->getDisconnectFrame(), $sync); } } } catch (StompException $ex) { // nothing! } if ($this->connection) { $this->connection->disconnect(); } $this->sessionId = null; $this->unprocessedFrames = []; $this->protocol = null; $this->isConnecting = false; }