/** * @inheritdoc */ public function handleMessage(AbstractMessage $message, ConnectionInterface $sender) { if ($message->getType() !== AbstractMessage::TYPE_AUTHENTICATION_REQUEST) { return false; } /* @var AuthenticationRequest $message */ $status = AuthenticationResponse::STATUS_FAILURE; // Add the sender to the list of authenticated clients if ($message->getAccessToken() === $this->configuration->getAccessToken()) { $status = AuthenticationResponse::STATUS_SUCCESS; $this->_authenticatedClients->attach($sender); $this->logger->notice('Client authenticated successfully'); } else { $this->logger->warning('Got invalid authentication request from client'); } return new AuthenticationResponse($status); }