/**
* @param TcpConnection $tcpConnection
* @param bool $isForce
*
* @return void
*/
public static function WsClose($tcpConnection, $isForce)
{
$tcpConnection->close();
if (! $isForce ||
TcpConnection::STATUS_CLOSING !== $tcpConnection->getStatus() ||
! $tcpConnection->getSendBufferQueueSize()) {
return;
}
// force write data to call destroy & onClose event
$tcpConnection->baseWrite();
}