OpenSwoole Server pause

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

Declaration

<?php OpenSwoole\Server->pause(int $fd)

Parameters

fd

The file descriptor number of the client connection you want to pause

Return

success

If success, it returns 'true', otherwise it returns false.

Description

Pauses the data receiving for the specified $fd client.

Things to consider

  • After calling this method, the connection will be removed from the event loop and no more client data will be received
  • This method does not affect the processing of the send queue
  • When in OpenSwoole\Server::POOL_MODE mode, calling this method may still allow some data to be received before it is actually paused, which could trigger the onReceive event
  • This method is only really recommended to be used in OpenSwoole\Server::SIMPLE_MODE mode

Checkout resume for how to restart the client connection.

Last updated on September 20, 2022