Private
Public Access
1
0

chg: usr: make the first working version - the stepping is broken due to the algorythm structure #4

This commit is contained in:
2026-04-09 12:10:37 +02:00
parent dd4b410624
commit fa0fc0743d
51 changed files with 8355 additions and 55172 deletions

View File

@@ -23,6 +23,7 @@ use Psr\Log\LoggerInterface;
use Ratchet\ConnectionInterface;
use Ratchet\Wamp\Topic;
use Symfony\Component\HttpFoundation\RequestStack;
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
/**
* Class TopicManager
@@ -74,7 +75,7 @@ class TopicManager extends WebsocketManager implements TopicManagerInterface
{
/** this will broadcast the message to ALL subscribers of this topic. */
$user = $this->clientManipulator->getClient($connection);
$userName = is_string($user) ? $user : $user->getUsername();
$userName = $user->getUserIdentifier();
/** if more user wants to connect than 2 to one channel */
if ($topic->count() > 2) {
@@ -107,7 +108,7 @@ class TopicManager extends WebsocketManager implements TopicManagerInterface
public function publish(Topic $topic, ConnectionInterface $connection, $event): void
{
$user = $this->clientManipulator->getClient($connection);
$userName = is_string($user) ? $user : $user->getUsername();
$userName = $user->getUserIdentifier();
/** Save every step by user to db */
null === $event['resign']
@@ -193,7 +194,7 @@ class TopicManager extends WebsocketManager implements TopicManagerInterface
*
* @return array
*/
private function controlUsers(Topic $topic, string $userName, $user): array
private function controlUsers(Topic $topic, string $userName, TokenInterface $user): array
{
$gameAssoc = explode('/', $topic->getId())[2];
@@ -229,7 +230,7 @@ class TopicManager extends WebsocketManager implements TopicManagerInterface
*
* @return array
*/
private function saveUserToDb(Topic $topic, string $userName, $user, $count)
private function saveUserToDb(Topic $topic, string $userName, TokenInterface $user, $count)
{
$gameAssoc = explode('/', $topic->getId())[2];
@@ -239,7 +240,7 @@ class TopicManager extends WebsocketManager implements TopicManagerInterface
->findOneByGameAssoc($gameAssoc);
/** when the user is not anonym */
!is_string($user)
null !== $user->getUser()
? $this->saveRegisteredUser($userName, $count, $playedGame)
: $this->saveAnonUser($userName, $count, $playedGame);