This is an example of how to use manual basic or digest HTTP authentication.
<?php
require '../websock2.php';
define('EOL', php_sapi_name() === 'cli' ? PHP_EOL : '<br>');
$response = $socket->sendRequest($request);
echo $response->getHeadersData() . EOL . EOL;
die('Incorrect authentication method!');
$request->setBoundary(md5(mt_rand()));
$request->getHeaderManager()->replaceHeader('Cookie', 'fake=fake_value');
echo $socket->sendRequest($request)->getHeadersData();