@DI\Observe("claroline_message_sending")

@param Claroline\CoreBundle\Event\SendMessageEvent $event
428567
public function onMessageSending(SendMessageEvent $event)
    {
        $receiver = $event->getReceiver();
        $sender = $event->getSender();
        $content = $event->getContent();
        $object = $event->getObject();
        $withMail = $event->getWithMail();
        $this->messageManager->sendMessageToAbstractRoleSubject(
            $receiver,
            $content,
            $object,
            $sender,
            $withMail
        );
    }
472666
public function onMessage(MessageEvent $event){
        if($event->message instanceof HttpRequest){
            return $this->processHandshake($event);
        }
        
        if(!($event->message instanceof Request)){
            Yii::error("message for ".get_class($this).'::onMessage must be StreamRequest');
            return ;
        }
        
        return $this->processStream($event);
    }
26103
public function queueEvent($event)
    {
        $this->queue->enqueue($event);

        $class = get_class($event);
        foreach ($this->synchronousEventMap->getListenersForEvent($class) as $listener)
        {
            $this->invokeListener($listener, $event);
        }
    }
403146
public function logMessage($message)
    {
        $this->logger->info(strip_tags($message));

        if ($this->sendToBrowser) {
            $this->sendMessageToBrowser($message);
        }

        if ($this->sendToCli) {
            $this->sendMessageToCli($message);
        }
    }
758770
public function addMessage(AddMessageEvent $event)
    {
        /** @var Message $messageAdapter */
        $messageAdapter = $this->framework->getAdapter(Message::class);

        $messageAdapter->add($event->getContent(), 'TL_' . strtoupper($event->getType()));
    }
480097
public function sendAll($msg) : void
    {
        foreach ($this->subscriptionTable->findActive() as $row)
        {
            $this->sendNotification($row, $msg, false);
        }

        if ($flush)
        {
            $this->flush();
        }
    }
631623
public function sendEvent($name, $message)
    {
        if (false == $message instanceof Message) {
            $message = $this->context->createMessage($message);
        }

        $message->setProperty(Config::TOPIC, $name);

        $topic = $this->context->createTopic('enqueue.default');
        $topic->setType(AmqpTopic::TYPE_FANOUT);
        $topic->addFlag(AmqpTopic::FLAG_DURABLE);

        $this->context->createProducer()->send($topic, $message);
    }
142140
public function sendPerformed(Swift_Events_SendEvent $evt)
    {
        $message = $evt->getMessage();

        // restore original headers
        $headers = $message->getHeaders();

        if ($headers->has('X-Swift-Return-Path')) {
            $message->setReturnPath($headers->get('X-Swift-Return-Path')->getAddress());
            $headers->removeAll('X-Swift-Return-Path');
        }
    }
483884
public function onWSClientCommand(WSEventDispatcher\WSClientEvent $event)
    {
        //$command = $event->getCommand();
        //$arguments = $event->getArguments();
        $this->data['commands'][] = array(
            'command'   => $event->getCommand(),
            'arguments' => $event->getArguments(),
            'url' => $event->getUrl(),
            'cache' => $event->getUseCache(),
            'content' => $event->getContent(),
            'key' => $event->getKey(),
            'statusCode' => $event->getStatusCode(),
            'executiontime' => $event->getTiming()
        );
    }
432368
public function sendMessage(SendMessageRequest $request)
    {
        $response = new SendMessageResponse();
        return $this->client->sendRequest($request, $response);
    }
519201
public function send(Event $event)
    {
        $message = $this->getEventMessage($event);
        $this->flush($message);
    }
1179368
public function sendText (Type\Text $message)
    {
        $this->sendReply(
            $this->buildMessage(
                [
                    'MsgType' => $message->getType(),
                    'Content' => $message->getContent(),
                ]
            )
        );
    }
85211
public function setEvent($event)
  {
    if ($event === '?' || $event === '') {
      $this->event = null;
    } else {
      $event = Util::foreignLettersToEnglishLetters($event);
      $event = Util::titleCaseIfCurrentlyAllCaps($event);
      $this->event = $event === '?' ? null : $event;
    }
  }
1352296
public function sendMessage(Message $msg)
    {
        $this->lastOutboundActivity = microtime(true);
        $this->dispatchMessage($msg, 'Send');
    }
1104629
private static function onReceivedMessage(string $event, $data)
    {
        foreach (self::$onMessage[$event] ?? [] as $callback) {
            asyncCall($callback, $data);
        }
    }
215429
public function onMessageReceived(MessageReceivedEvent $event)
    {
        if ($this->received === 0) {
            $this->started = microtime(true);
        } else if ($this->received === $this->count) {
            $time = microtime(true);
            $elapsed = $time - $this->started;
            printf("Time spent to receive {$this->count} messages: %.3f secs (%.3f m/s)\n", $elapsed, $this->count / $elapsed);
            $this->started = $time;
            $this->received = 0;
        }
        $this->received++;
    }
277945
public function sendMessage(Message $message): void
    {
        // Ensure the message will always be sent to the default channel if asked for.
        if ($this->options['sticky_channel']) {
            $message->setChannel($this->options['channel']);
        }

        $payload = $this->preparePayload($message);

        $encoded = \json_encode($payload, JSON_UNESCAPED_UNICODE);

        if (false === $encoded) {
            throw new \RuntimeException(\sprintf('JSON encoding error %s: %s', \json_last_error(), \json_last_error_msg()));
        }

        $this->httpClient->post('', [], $encoded);
    }