Exemple #1
0
 /**
  * This will receive any Publish requests for this topic.
  *
  * @param ConnectionInterface $connection
  * @param Topic $topic
  * @param WampRequest $request
  * @param $event
  * @param array $exclude
  * @param array $eligible
  * @return mixed|void
  */
 public function onPublish(ConnectionInterface $connection, Topic $topic, WampRequest $request, $event, array $exclude, array $eligible)
 {
     $user = $this->refreshUserFromBase($this->clientManipulator->getClient($connection));
     $teamId = $this->getTeamId($topic);
     if ($user && is_object($user) && !$this->checkUserIsMuted($user, $teamId)) {
         try {
             $this->teamMessage->insertMessage($this->clientManipulator->getClient($connection), $teamId, $event);
         } catch (Exception $e) {
             // todo log ici
         }
         $name = $user->getDisplayName() ? $user->getDisplayName() : $user->getUsername();
         $topic->broadcast(['user' => $name, 'msg' => $event]);
     }
 }
Exemple #2
0
 /**
  * This will receive any Publish requests for this topic.
  *
  * @param ConnectionInterface $connection
  * @param Topic $topic
  * @param WampRequest $request
  * @param $event
  * @param array $exclude
  * @param array $eligible
  * @return mixed|void
  */
 public function onPublish(ConnectionInterface $connection, Topic $topic, WampRequest $request, $event, array $exclude, array $eligible)
 {
     $user = $this->refreshUserFromBase($this->clientManipulator->getClient($connection));
     $teamId = $this->getTeamId($topic);
     if ($event['action'] == 'map') {
         $this->templateList[$topic->getId()] = $event['data'];
     }
     if ($user && is_object($user) && !$this->checkUserIsMuted($user, $teamId)) {
         $topic->broadcast(['msg' => $event]);
     }
 }
 /**
  * This will receive any Publish requests for this topic.
  *
  * @param  ConnectionInterface $connection
  * @param  Topic $topic
  * @param  WampRequest $request
  * @param  $event
  * @param  array $exclude
  * @param  array $eligible
  */
 public function onPublish(ConnectionInterface $connection, Topic $topic, WampRequest $request, $event, array $exclude, array $eligible)
 {
     $user = $this->clientManipulator->getClient($connection);
     $message = $this->messagesManager->getMessage('conversation', $user, $event);
     $topic->broadcast(['msg' => $message->render()]);
     $this->messagesManager->save($message);
 }