发送单聊消息
@param SendMessageRequest $request
@return BaseResponse
@throws Exception\TIMException
432368
public function sendMessage(SendMessageRequest $request)
    {
        $response = new SendMessageResponse();
        return $this->client->sendRequest($request, $response);
    }
1207018
public function sendRequest(Request $request)
	{
		$this->prepareRequest($request);

		$result = curl_exec($this->ch);

		if ($result === false) {
			$errno = curl_errno($this->ch);
			$errmsg = curl_error($this->ch);
			$msg = "cURL request failed with error [$errno]: $errmsg";
			curl_close($this->ch);
			throw new cURLException($request, $msg, $errno);
		}

		$response = $this->createResponseObject($result);

		curl_close($this->ch);

		return $response;
	}
226744
public function send(Request $request)
    {
        $afterValidate = $request->get('afterValidate');
        $notifications = (array) $request->get('notifications', []);

        if (! $afterValidate) {
            return $this->form->get()->isValid();
        }

        $this->fire($this->findModel($notifications));

        return new JsonResponse(['message' => trans('antares/notifications::messages.widget_notification_added_to_queue')]);
    }
502384
public function send(AbstractRequest $request)
    {
        try {

            $client = $this->client;
            $config = $this->config;

            if(false === $config->isValid()) {
                throw new \Exception("Configuration is not valid.");
            }

            if(is_null($client)) {
                throw new \Exception('Zend\Http\Client must be set and must be valid.');
            }

            if(false === $request->isValid()) {
                throw new \Exception(get_class($request) . " is invalid.");
            }

            $client->setMethod('POST');
            $client->setUri(new \Zend\Uri\Http($config->getEndpoint()));
            $client->setRawBody($config . $request);

            $httpResponse = $client->send();

            $response = Response::factory($request->getMethod(), $httpResponse->getBody());

        } catch(\Exception $e) {

            $response = new Response();
            $response->addErrorMessage($e->getMessage());
        }

        return $response;
    }
334264
public function send(Request $request)
    {
        $response      = new DeleteIndexResponse();
        $rpbDeleteReq  = $this->createRpbMessage($request);

        $this->client->send($rpbDeleteReq, RiakMessageCodes::YOKOZUNA_INDEX_DELETE_REQ, RiakMessageCodes::DEL_RESP);

        return $response;
    }
1112782
public function addRequest(Request $request)
    {
        $attributes = $this->createAttributes($request);

        $exchange = $this->getExchange($request->server());

        $message = json_encode($request->params());

        if (json_last_error() !== JSON_ERROR_NONE) {
            throw new Exception\InvalidArgumentException('Error during json encoding');
        }

        $exchange->publish($message, $request->routingKey(), Constants::AMQP_NOPARAM, $attributes);

        if (null !== $request->id()) {
            $this->requestIds[] = $request->id();
        }

        if (0 !== $request->expiration() && ceil($request->expiration() / 1000) > $this->timeout) {
            $this->timeout = ceil($request->expiration() / 1000);
        }

        ++$this->countRequests;
    }
231355
protected function doSendRequest(Request $request): Response
    {
        if (!$this->shouldUseGearman()) {
            return $this->locator->getRequestBus()->receiveRequest($request);
        }

        $envelope = new TransportEnvelope($request, 'php');
        $channel = $this->router->forRequest($request);

        try {
            $client = $this->getClient();
            $result = @$client->doNormal($channel, $envelope->toString(), (string)$request->get('request_id'));
            $this->validateReturnCode($client, $channel);
            return TransportEnvelope::fromString($result)->getMessage();
        } catch (\GearmanException $ge) {
            if (isset(self::$reconnectCodes[$ge->getCode()])) {
                $this->destroyClient();
                return $this->locator->getRequestBus()->receiveRequest($request);
            }

            throw $ge;
        } catch (\Throwable $e) {
            throw $e;
        }
    }
1279098
public function sendRequest(Request $request)
    {
        $response = $this->httpClient->send($request);

        $this->checkErrorResponse($response);

        return $response;
    }
415700
public function send($request)
    {
        $this->handle->init();

        $this->handle->setOption(CURLOPT_URL, $request->getURL());
        $this->handle->setOption(CURLOPT_HTTPHEADER, $request->getHeaders());
        $this->handle->setOption(CURLOPT_RETURNTRANSFER, true);
        $this->handle->setOption(CURLOPT_CONNECTTIMEOUT, $this->getTimeout());
        $this->handle->setOption(CURLOPT_TIMEOUT, $this->getTimeout());
        $this->handle->setOption(CURLOPT_SSL_VERIFYHOST, 2);
        $this->handle->setOption(CURLOPT_SSL_VERIFYPEER, true);

        $data = $this->handle->execute();
        $info = $this->handle->getInfo();
        $error = $this->handle->getError();

        $this->handle->close();

        /*
         * A failure occurred if:
         * payload is false (e.g. HTTP timeout?).
         * info is false, then it has no HTTP status code.
         */
        if (strlen($error) > 0) {
            throw new KlarnaException(
                "Connection failed with error: {$error}"
            );
        }

        return $request->createResponse(intval($info['http_code']), $data);
    }
431233
private function dispatchRequest($request)
    {
        // track the number of requests across instances
        self::$requestCount++;
        $timestart = microtime(true);

        $response = self::transport()->send($request);

        // pass the response through the filter chain
        foreach ($this->filters as $filter) {
            $response = $filter->response($response);
        }

        $httpCode = $response->getStatus()->getCode();
        $location = $response->getHeaders()->value('Location');
        $body = $response->getBody();

        // track the time taken across instances
        self::$requestTime += microtime(true) - $timestart;

        // process a redirect if needed
        if ($httpCode < 400 && $location) {
            return $this->redirect($location);
        } else {
            $this->redirects = 0;
        }

        // translate error code to a typed exception
        if ($httpCode == 500) {
            throw new Error\InternalServerError($body);
        } elseif ($httpCode == 400) {
            throw new Error\BadRequest($body);
        } elseif ($httpCode == 401) {
            throw new Error\Unauthorized($body);
        } elseif ($httpCode == 404) {
            throw new Error\NotFound($body);
        } elseif ($httpCode >= 300) {
            throw new Error($body, $httpCode);
        }

        return $response;
    }
712132
public function sendRequest(Http\Request $httpRequest)
    {
        $requestHandler = $this->bootstrap->getActiveRequestHandler();
        if (!$requestHandler instanceof FunctionalTestRequestHandler) {
            throw new Http\Exception('The browser\'s internal request engine has only been designed for use within functional tests.', 1335523749);
        }

        $this->securityContext->clearContext();
        $this->validatorResolver->reset();

        $response = new Http\Response();
        $componentContext = new ComponentContext($httpRequest, $response);
        $requestHandler->setComponentContext($componentContext);

        $objectManager = $this->bootstrap->getObjectManager();
        $baseComponentChain = $objectManager->get(\Neos\Flow\Http\Component\ComponentChain::class);
        $componentContext = new ComponentContext($httpRequest, $response);

        try {
            $baseComponentChain->handle($componentContext);
        } catch (\Throwable $throwable) {
            $this->prepareErrorResponse($throwable, $componentContext->getHttpResponse());
        } catch (\Exception $exception) {
            $this->prepareErrorResponse($exception, $componentContext->getHttpResponse());
        }
        $session = $this->bootstrap->getObjectManager()->get(SessionInterface::class);
        if ($session->isStarted()) {
            $session->close();
        }
        $this->persistenceManager->clearState();
        return $componentContext->getHttpResponse();
    }
1246983
public function send(Request $request)
    {
        $this->monitor->start($this->metricName, ['service_key' => $request->getServiceKey(), 'request_key' => $request->getRequestKey()]);
        $response = $this->sender->send($request);
        $this->monitor->end($this->metricName, ['response_status' => $response->getStatusCode()]);
        return $response;
    }
1275205
public function send(AbstractRequest $request)
    {
        $handle = HandleFactory::build($request);
        $this->dispatch(MessageEvent::REQUEST, new MessageEvent($request));

        try {
            $result = $handle->execute();
        } catch (\Exception $error) {
            if ($error instanceof CurlException) {
                $response = ResponseFactory::build('', $handle->infos(), $request);
                $error->setResponse($response);
            }
            $this->dispatch(ErrorEvent::ERROR, new ErrorEvent($error));
            throw $error;
        }

        $response = ResponseFactory::build($result, $handle->infos(), $request);
        $this->dispatch(MessageEvent::RESPONSE, new MessageEvent($response));

        return $response;
    }
785628
public function send(Request $request)
    {
        $curl = $this->prepareRequest($request);
        
        $data = curl_exec($curl);
        if (false === $data) {
            $errorMsg = curl_error($curl);
            $errorNo  = curl_errno($curl);

            throw new \RuntimeException($errorMsg, $errorNo);
        }
        
        $data = $this->filterRawResponse($data);
        
        return $this->prepareResponse($data, curl_getinfo($curl, CURLINFO_HTTP_CODE));
    }
806249
public function importMessage(ImportMessageRequest $request)
    {
        $response = new ImportMessageResponse();
        return $this->client->sendRequest($request, $response);
    }
161334
public function messagesSendAction(Request $request)
    {
        $query = $request->request->all();
        $messages = $this->om->findList('Claroline\PlannedNotificationBundle\Entity\Message', 'uuid', $query['messages']);
        $users = $this->om->findList('Claroline\CoreBundle\Entity\User', 'uuid', $query['users']);
        $this->manager->sendMessages($messages, $users);

        return new JsonResponse('success', 200);
    }
27463
public function send(Request $request)
    {
        $response = new IndexQueryResponse();
        $rpbReq   = $this->createRpbMessage($request);
        $socket   = $this->client->emit($rpbReq, RiakMessageCodes::INDEX_REQ);
        $iterator = new ProtoStreamIterator($this->client, $socket, RiakMessageCodes::INDEX_RESP);

        $response->iterator = new ProtoIndexQueryResponseIterator($request, $iterator);

        return $response;
    }