<?php declare(strict_types=1);
/**
 * @package messenger
 * @author kputyr
 * @date 23.03.2026
 */

#
# This script runs when a client disconnects
#
namespace IMATHUZH\Messenger;

require_once 'request.php';

try {
    $request = NchanRequest::fromServerRequest();
    logmsg("unsub - INFO - request uri " . $request->requestUri);
    logHeaders('unsub');

    $request->generateUrls();

    logmsg("unsub - INFO - request uri {$request->requestUri}");
    logmsg("unsub - INFO - notifying {$request->controllerUrl}");
    $request->notifyController('unsub');
    logmsg("unsub - INFO - done");


} catch (\Throwable $e) {
    logmsg('unsub - ERROR - ' . $e->getMessage());
}
