Files
michaelschiemer/scripts/test/websocket.php
Michael Schiemer 887847dde6 refactor: reorganize project structure for better maintainability
- Move 45 debug/test files from root to organized scripts/ directories
- Secure public/ directory by removing debug files (security improvement)
- Create structured scripts organization:
  • scripts/debug/      (20 files) - Framework debugging tools
  • scripts/test/       (18 files) - Test and validation scripts
  • scripts/maintenance/ (5 files) - Maintenance utilities
  • scripts/dev/         (2 files) - Development tools

Security improvements:
- Removed all debug/test files from public/ directory
- Only production files remain: index.php, health.php

Root directory cleanup:
- Reduced from 47 to 2 PHP files in root
- Only essential production files: console.php, worker.php

This improves:
 Security (no debug code in public/)
 Organization (clear separation of concerns)
 Maintainability (easy to find and manage scripts)
 Professional structure (clean root directory)
2025-10-05 10:59:15 +02:00

47 lines
1.3 KiB
PHP
Executable File

#!/usr/bin/env php
<?php
declare(strict_types=1);
require __DIR__ . '/vendor/autoload.php';
require __DIR__ . '/src/Framework/Debug/helpers.php';
use App\Framework\Core\AppBootstrapper;
use App\Framework\DateTime\SystemClock;
use App\Framework\DateTime\SystemHighResolutionClock;
use App\Framework\Http\WebSocketServer;
use App\Framework\Performance\EnhancedPerformanceCollector;
use App\Framework\Performance\MemoryMonitor;
// Bootstrapping mit minimaler Konfiguration
$bootstrapper = new AppBootstrapper(
getcwd(),
new EnhancedPerformanceCollector(
new SystemClock(),
new SystemHighResolutionClock(),
new MemoryMonitor(),
false),
new MemoryMonitor,
);
$container = $bootstrapper->bootstrapWebSocket();
// WebSocket-Server erstellen und konfigurieren
$server = $container->get(WebSocketServer::class);
// Signal-Handler für sauberes Beenden
pcntl_signal(SIGTERM, function () use ($server) {
echo "Beende WebSocket-Server..." . PHP_EOL;
$server->stop();
exit(0);
});
pcntl_signal(SIGINT, function () use ($server) {
echo "Beende WebSocket-Server..." . PHP_EOL;
$server->stop();
exit(0);
});
// Server starten (blockierend)
echo "WebSocket-Server wird gestartet..." . PHP_EOL;
$server->start('0.0.0.0', 8080);