/**
  * @param ConnectionInterface        $conn
  * @param \Ratchet\Wamp\Topic|string $topic
  */
 public function onUnSubscribe(ConnectionInterface $conn, $topic)
 {
     $user = $this->clientStorage->getClient($conn->WAMP->clientStorageId);
     $username = $user instanceof UserInterface ? $user->getUsername() : $user;
     $this->logger->info(sprintf('User %s unsubscribed to %s', $username, $topic->getId()));
     $wampRequest = $this->wampRouter->match($topic);
     $this->topicDispatcher->onUnSubscribe($conn, $topic, $wampRequest);
 }
 /**
  * @param ConnectionInterface $conn
  */
 public function onClose(ConnectionInterface $conn)
 {
     foreach ($conn->WAMP->subscriptions as $topic) {
         $wampRequest = $this->wampRouter->match($topic);
         $this->topicDispatcher->onUnSubscribe($conn, $topic, $wampRequest);
     }
     $event = new ClientEvent($conn, ClientEvent::DISCONNECTED);
     $this->eventDispatcher->dispatch(Events::CLIENT_DISCONNECTED, $event);
 }