Swoole Server pause

Notice: the documentation is suitable for PHP extension swoole until v4.7.1, we only support PHP extension openswoole from v4.7.1

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.