<?php
// Test simple de SSE
header('Content-Type: text/event-stream');
header('Cache-Control: no-cache');
header('Connection: keep-alive');
header('X-Accel-Buffering: no');

if (ob_get_level()) ob_end_clean();
@ini_set('output_buffering', 'off');
@ini_set('zlib.output_compression', 'off');

echo "event: connected\n";
echo "data: " . json_encode(['test' => true, 'timestamp' => time()]) . "\n\n";

if (ob_get_level()) ob_flush();
flush();

echo ": heartbeat\n\n";
flush();

// Log para debug
error_log('SSE Test: enviado evento connected');
