destroy
Description:
void Connection::destroy()
Immediately closes the connection.
The difference from close is that after calling destroy, even if there is data in the sending buffer of the connection that has not been sent to the peer, the connection will be closed immediately, and the onClose callback for that connection will be triggered immediately.
Parameters
No parameters
Example
use Workerman\Worker;
use Workerman\Connection\TcpConnection;
require_once __DIR__ . '/vendor/autoload.php';
$worker = new Worker('websocket://0.0.0.0:8484');
$worker->onMessage = function(TcpConnection $connection, $data)
{
// if something wrong
$connection->destroy();
};
// Run worker
Worker::runAll();