Join 4,000+ others and never miss out on new tips, tutorials, and more.
4.x is outdated, please check the latest version 22.x
Latest version:
pecl install openswoole-22.1.2
<?php Swoole\Coroutine\Http2\Client->isStreamExist(int $streamId): bool
The ID of the stream you want to check, see example section for more details.
Returns true
if the stream does exist and false
when the stream does not.
Determine whether the specified stream still exists or not.
Check the main Quick Start Examples to see how the isStreamExist()
method can be used in a client context.
All you need to do is pass the stream ID which can be gotten from the stats()
method:
<?php
...
$currentStreamId = $client->stats('current_stream_id');
$lastStreamId = $client->stats('last_stream_id');
...
if($client->isStreamExist(currentStreamId))
{
// ...
}
...