create a new message by using receiverid.

@param int    $receiverId
@param string $message

@return \Nahid\Talk\Messages\Message
977715
public function sendMessageByUserId($receiverId, $message)
    {
        if ($conversationId = $this->isConversationExists($receiverId)) {
            $message = $this->makeMessage($conversationId, $message);

            return $message;
        }

        $convId = $this->newConversation($receiverId);
        $message = $this->makeMessage($convId, $message);

        return $message;
    }
510875
private function create($messageClass, $message)
    {
        $interfaces = array_values(class_implements($messageClass, true));
        return new IncomingLogicalMessage($message, $messageClass, $interfaces);
    }
1365548
private function createNotification(\ArrayIterator $recipients, MessageInterface $message)
    {
        $message = clone $message;
        $message->setRecipientDeviceCollection($recipients);

        $handlers = $this->getPayloadHandlers();

        foreach ($handlers as $handler) {
            if ($handler->isSupported($message)) {
                $notificationId = uniqid();
                $handler
                    ->setNotificationId($notificationId)
                    ->setMessage($message);

                $packedPayload  = $this->handlePayload($handler);
                $customData     = $handler->getCustomNotificationData();

                $notification = new Notification();
                $notification
                    ->setIdentifier($notificationId)
                    ->setType($message->getMessageType())
                    ->setRecipients($recipients)
                    ->setPayload($packedPayload)
                    ->setCustomNotificationData($customData)
                ;
                return $notification;
            }
        }

        throw new DomainException(
            sprintf(
                'Unhandled message type %s',
                $message->getMessageType()
            )
        );
    }
1043772
public function fromMessage($message)
    {
        static $parser;
        if (!$parser) {
            $parser = new MessageParser();
        }

        // Parse a response
        if (strtoupper(substr($message, 0, 4)) == 'HTTP') {
            $data = $parser->parseResponse($message);
            return $this->createResponse(
                $data['code'],
                $data['headers'],
                $data['body'] === '' ? null : $data['body'],
                $data
            );
        }

        // Parse a request
        if (!($data = ($parser->parseRequest($message)))) {
            throw new \InvalidArgumentException('Unable to parse request');
        }

        return $this->createRequest(
            $data['method'],
            Url::buildUrl($data['request_url']),
            [
                'headers' => $data['headers'],
                'body' => $data['body'] === '' ? null : $data['body'],
                'config' => [
                    'protocol_version' => $data['protocol_version']
                ]
            ]
        );
    }
841738
@Override
    public Message newMessage(final String message) {
        final ReusableSimpleMessage result = getSimple();
        result.set(message);
        return result;
    }
817701
public function fromProducedMessage(AMQPMessage $message)
    {
        $currentSpan = $this->spanStack->current();

        return new Span(
            $this->identifierGenerator->generate(),
            $this->getMessageName($message),
            null !== $currentSpan ? $currentSpan->getTraceIdentifier() : $this->identifierGenerator->generate(),
            [
                new Annotation(Annotation::CLIENT_SEND, $this->clock->microseconds(), $this->endpointResolver->resolve()),
            ],
            [],
            $currentSpan !== null ? $currentSpan->getIdentifier() : null,
            $currentSpan !== null ? $currentSpan->getDebug() : null,
            $this->clock->microseconds()
        );
    }
19897
public function sendMessageTo( $message, $receiver )
	{
		if( is_string( $receiver ) )
			$receiver	= new Net_XMPP_JID( $receiver );
		if( !$this->xmpp )
			throw new RuntimeException( 'Not connected to Server.' );
		$this->xmpp->message( $receiver->get(), $message );
	}
1292018
public static function fromMessage(Message $msg)
    {
        $request_id = $msg->shift();
        $result     = $msg->shift() ?: '';

        return new self($request_id, $result);
    }
1284997
public function send($mobileNumber, $message, $messageId = null)
    {
        return $this->sendAsync($mobileNumber, $message, $messageId)
        ->then(
            function (ResponseInterface $response) {
                return new SentResponse($response, $this->requestForm);
            },
            function ($exception) {
                return $this->throwError($exception);
            }
        )->wait();
    }
895505
public function add(Message $message)
    {
        $this->queue->insert($message, is_null($message->getPosition()) ? null : -$message->getPosition());

        $this->copyQueue(clone $this->queue);

        return $this;
    }
1291418
public function message($name, $message='')
    {
        if (is_array($name)) {
            $this->message=array_merge($this->message, $name);
        } else {
            $this->message[$name]=$message;
        }
        return $this;
    }
97037
public static function fromMessage(Message $msg)
    {
        $count = $msg->shift();

        if ($count != $msg->count()) {
            throw new InvalidArgumentException(
                'The action count is not the same as the actual number of actions.');
        }

        return new self($msg->toArray());
    }
263344
public function createCollectorMessage($collectorId, array $data = [])
	{
		return $this->sendRequest(
			$this->createRequest('POST', sprintf('collectors/%s/messages', $collectorId), [], $data)
		);
	}
144386
private function prepareRequest(MessageInterface $message, RecipientInterface $recipient) {
        $uri = new Uri($recipient->getEndpoint());
        return Pusher::createStandardRequest($message, $recipient)->withUri($uri);
    }
352564
public function create($message = null)
    {
        $this->arguments[] = 'create';
        if ($message) {
            $this->arguments[] = $message;
        }
        return $this->run();
    }
530353
@Override
    public Message newMessage(final Object message) {
        final ReusableObjectMessage result = getObject();
        result.set(message);
        return result;
    }
1324659
public static function create(array $payload): self
    {
        $senderId = $payload['sender']['id'];
        $recipientId = $payload['recipient']['id'];
        $timestamp = $payload['timestamp'];
        $message = Message::create($payload['message']);

        return new static($senderId, $recipientId, $timestamp, $message);
    }