Exemplo n.º 1
0
 /**
  * @param ConnectionInterface $connection
  *
  * @return false|string|\Symfony\Component\Security\Core\User\UserInterface
  */
 public function getClient(ConnectionInterface $connection)
 {
     $storageId = $this->clientStorage->getStorageId($connection);
     try {
         return $this->clientStorage->getClient($storageId);
     } catch (ClientNotFoundException $e) {
         //User is gone due to ttl
         $this->authenticationProvider->authenticate($connection);
         return $this->getClient($connection);
     }
 }
 /**
  * @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 $connection
  *
  * @return false|string|\Symfony\Component\Security\Core\User\UserInterface
  */
 public function getCurrentUser(ConnectionInterface $connection)
 {
     @trigger_error('User ClientManipulator service instead, will be remove in 2.0', E_USER_DEPRECATED);
     return $this->clientStorage->getClient($this->clientStorage->getStorageId($connection));
 }
 /**
  * @param ConnectionInterface $connection
  *
  * @return false|string|\Symfony\Component\Security\Core\User\UserInterface
  */
 public function getCurrentUser(ConnectionInterface $connection)
 {
     return $this->clientStorage->getClient($this->clientStorage->getStorageId($connection));
 }