/** * Handles the the given payload received by the given connection. * * @param ConnectionInterface $connection * @param Payload $payload */ protected function handle(ConnectionInterface $connection, Payload $payload) { switch ($payload->getEvent()) { case ConnectionEvent::SOCKET_AUTH_REQUEST: $this->handleAuthentication($connection, $payload); break; default: $this->eventDispatcher->dispatch($payload->getEvent(), new ConnectionEvent($connection, $payload)); $this->logger->notice(sprintf('Dispatched event: %s', $payload->getEvent())); } }