Esempio n. 1
0
 /**
  * @param PlayzoneMessage $playzoneMessage
  * @param $clientMessageType
  * @return object
  */
 private function getClientMessageObject(PlayzoneMessage $playzoneMessage, $clientMessageType)
 {
     $data = $this->container->get("jms_serializer")->deserialize(json_encode($playzoneMessage->getData()), 'WebsocketServerBundle\\Model\\Message\\Client\\' . $clientMessageType, 'json');
     return $data;
 }
Esempio n. 2
0
 /**
  * @param PlayzoneMessage $messageObject
  * @param ConnectionInterface $from
  */
 private function addGameForListen(PlayzoneMessage $messageObject, ConnectionInterface $from)
 {
     /** @var ClientMessageGameSubscribe $gameSubscribeMessage */
     $gameSubscribeMessage = $this->getObjectFromJson(json_encode($messageObject->getData()), 'WebsocketServerBundle\\Model\\Message\\Client\\Game\\ClientMessageGameSubscribe');
     foreach ($this->users as $wsUser) {
         if ($wsUser->getConnection() == $from) {
             $wsUser->addGameToListen($gameSubscribeMessage->getGameId());
         }
     }
 }