<?php $t = microtime(true);
$connection->on('close', function () use ($connection, $t, &$bytes) {
$t = microtime(true) - $t;
echo '[' . $connection->getRemoteAddress() . ' disconnected after receiving ' . $bytes . ' bytes in ' . round($t, 3) . 's => ' . round($bytes / $t / 1024 / 1024, 1) . ' MiB/s]' . PHP_EOL;
});
});