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

#
# This script runs when a client disconnects
#
use IMATHUZH\Messenger\Nchan\NchanRequest;

require_once 'common.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());
}
