Send notification by topic.
if isCondition is true, $topic will be treated as an expression

@param $topic
@param $message
@param bool $isCondition
@return object
435276
public function sendByTopic($topic, $message, $isCondition = false)
    {
        $headers = $this->addRequestHeaders();
        $data = $this->buildData($topic, $message, $isCondition);

        try {
            $result = $this->client->post(
                $this->url,
                [
                    'headers' => $headers,
                    'json' => $data,
                ]
            );

            $json = $result->getBody();

            $this->setFeedback(json_decode($json, false, 512, JSON_BIGINT_AS_STRING));

        } catch (\Exception $e) {
            $response = ['success' => false, 'error' => $e->getMessage()];

            $this->setFeedback(json_decode(json_encode($response)));

        } finally {
            return $this->feedback;
        }
    }
58626
public function send($message, array $options = [])
    {
        $config = Ioc::getConfig();

        if (empty($options['force']) && !$config->get('mail.enabled', true)) {
            return true;
        }

        if (\is_callable($message)) {
            $msgObject = $this->createMessage();

            $message = $message($msgObject, $this);

            if (!$message instanceof MailMessage) {
                $message = $msgObject;
            }
        }

        if (!$message instanceof MailMessage) {
            throw new \InvalidArgumentException(sprintf('Mail Message should instance of %s', MailMessage::class));
        }

        $this->triggerEvent('onMailerBeforeSend', [
            'message' => $message,
            'manager' => $this,
        ]);

        // Set default sender
        if (!$message->getFrom()) {
            if ($config->exists('mail.from.email')) {
                $message->from($config->get('mail.from.email'), $config->get('mail.from.name'));
            }
        }

        // CC/BCC
        if ($cc = $config->get('mail.cc')) {
            if (is_string($cc)) {
                $cc = array_filter(array_map('trim', explode(',', $cc)), 'strlen');
            }

            $message->cc($cc);
        }

        if ($bcc = $config->get('mail.bcc')) {
            if (is_string($bcc)) {
                $bcc = array_filter(array_map('trim', explode(',', $bcc)), 'strlen');
            }

            $message->bcc($bcc);
        }

        $result = $this->getAdapter()->send($message);

        $this->triggerEvent('onMailerAfterSend', [
            'message' => $message,
            'manager' => $this,
            'result' => &$result,
        ]);

        return $result;
    }
691980
public function event($topicUri, $payload)
    {
        $type = Protocol::MSG_EVENT;
        $data = array($type, $topicUri, $payload);
        $this->send($data);
    }
1265955
public boolean publish(String topicName, DefaultMessage message,boolean asynSend){
		if(routeEnv != null)topicName = routeEnv + "." + topicName;
		return producer.publish(topicName, message,asynSend);
	}
1205459
protected function onSuccess(array $message)
    {
        list($topic, $payload, $sequence) = $message;

        $sequence = strlen(bin2hex($sequence)) == PHP_INT_SIZE ?
            unpack('I', $sequence)[1] : 0;

        if ($this->sequence > 0 && (($this->sequence + 1) != $sequence)) {
            throw new UnexpectedValueException(
                "Broken sequence on sequence number $sequence. ".
                'Detected lost notifications.'
            );
        }

        return ($this->callback)(
            bin2hex($payload),
            $this->sequence = $sequence
        );
    }
671080
public function onPublish(ConnectionInterface $connection, Topic $topic, WampRequest $request, $event, array $exclude, array $eligible)
    {
        /*
            $topic->getId() will contain the FULL requested uri, so you can proceed based on that

            if ($topic->getId() == "chat/channel/shout") ????????????????¿¿¿¿¿¿¿¿¿¿¿¿¿¿
               //shout something to all subs.
        */

        $topic->broadcast([
            'msg' => $event
        ]);
    }
35255
public function warningToSession ($message, $isRaw = false, $canHide = true)
		{
			$this->toSession($message, Notification::WARNING, $isRaw, $canHide);
		}
1117837
public static function addMessageIfNotEmpty($message,$condition,$label='INFO'){
		if ( empty($condition)===false ) {
			self::debugbar()->addMessage($message,$label);
		}
	}
1104349
public function sendBatch($topic, $task, array $messages, array $options = [])
    {
        return array_walk($messages, function ($data) use ($topic, $task, $options) {
            $this->send($topic, $task, $data, $options);
        });
    }
464410
public function publishMessage(string $topicName, string $message){
        if(!$topicName || !$message){
            return $this->error('参数有误');
        }
        $topic = $this->client->getTopicRef($topicName);
        $request = new PublishMessageRequest($message);
        try{
            $topic->publishMessage($request);
            return $this->success('发布消息成功');
        }catch(MnsException $exception){
            return $this->parseException($exception, '发布消息');
        }
    }
594183
public static function addMessageIfEmpty($message,$condition,$label='INFO'){
		if ( empty($condition)===true ) {
			self::debugbar()->addMessage($message,$label);
		}
	}
297994
public function addMessage($message, $label = 'info', $isString = true)
    {
        if ($this->enabled()) {
            $this->debugbar['messages']->addMessage($message, $label, $isString);
        }

        return $this;
    }
583917
public boolean send(String topic, String message) throws IOException {
        List<Session> sessions = topicSubscribers.get(topic);
        if (sessions != null) {
            for (Session session : sessions) {
                session.getBasicRemote().sendText(message);
            }
        }
        return sessions != null;
    }
1219759
public function send($message = null, $status = null, $reason = null)
	{
		$this->response->setContent($message);
		$this->response->setStatusCode($status ? $status : 200);
	}
819963
public function sendTo(Recipient $recipient, MessageInterface $message)
    {
        $driver = "\\Eyewitness\\Eye\\Notifications\\Drivers\\".ucfirst(strtolower($recipient->type));

        if (class_exists($driver)) {
            $channel = app($driver);
            $channel->fire($recipient, $message);
        } else {
            app(Eye::class)->logger()->debug('Notification Driver does not exist', $driver);
        }
    }
1206161
protected function notify($touser, $fromuser, $name='courserequested', $subject, $message, $courseid = null) {
        $eventdata = new \core\message\message();
        $eventdata->courseid          = empty($courseid) ? SITEID : $courseid;
        $eventdata->component         = 'moodle';
        $eventdata->name              = $name;
        $eventdata->userfrom          = $fromuser;
        $eventdata->userto            = $touser;
        $eventdata->subject           = $subject;
        $eventdata->fullmessage       = $message;
        $eventdata->fullmessageformat = FORMAT_PLAIN;
        $eventdata->fullmessagehtml   = '';
        $eventdata->smallmessage      = '';
        $eventdata->notification      = 1;
        message_send($eventdata);
    }
1127183
public function messageToSession ($message, $isRaw = false, $canHide = true)
		{
			$this->toSession($message, Notification::MESSAGE, $isRaw, $canHide);
		}