Swoole\Coroutine\Http2\Client->send(...)

Declaration

<?php
Swoole\Coroutine\Http2\Client->send(Swoole\Http2\Request $request): int|bool

Parameters

request

Return

Returns an integer starting from 1, if the return flow is of an odd increment it means something went wrong with the previous send operation or false is returned when the request cannot be sent at all. Check $client->errCode for more details.


Description

Send a request to the server, automatically establishing a HTTP/2 stream for you. Multiple requests can be initiated at the same time.

This method expects a Swoole\Http2\Request object, you build up this object before you call send(), this is what the client will use when sending the request to the remote host, based on the settings within the object given.

The Swoole\Http2\Request object does not have any methods, only public class properties which you can set to build a request you want to send. To learn more about the request object, check its documentation.


Example

Check the main Quick Start Examples to see how the send() method is used in its full context.