Swoole Server pause

4.x is outdated, please check the latest version 22.x


Latest version: pecl install openswoole-22.1.2

Declaration

<?php Swoole\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 SWOOLE_PROCESS 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 SWOOLE_BASE mode

Checkout resume for how to restart the client connection.

Last updated on August 31, 2022