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)
This commit is contained in:
46
scripts/test/websocket.php
Executable file
46
scripts/test/websocket.php
Executable file
@@ -0,0 +1,46 @@
|
||||
#!/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);
|
||||
Reference in New Issue
Block a user