OpenSwoole\Coroutine\Http2\Client->connect(...)

Latest version: pecl install openswoole-22.1.2 | composer require openswoole/core:22.1.5

Declaration

<?php OpenSwoole\Coroutine\Http2\Client->connect(): bool

Parameters

None

Return

Returns true when successfully establishes a connection and false if something went wrong, check the contents of $client->errCode to see the specific error code.


Description

Connect to the remote server. This method does not have any parameters.

When calling this method it will perform blocking IO operations so OpenSwoole will automatically switch to another waiting coroutine so resources are not wasted and come back when a connection has been made or if something is wrong.

You must successfully call connect() to use other methods like send() or recv() etc.


Example

Check the main Quick Start Examples to see how the connect() method is used.

Last updated on September 1, 2022