# FastAPI Processing Simulator - PowerShell Client Runner # This script provides easy ways to run the WebSocket client Write-Host "" Write-Host "================================================" -ForegroundColor Cyan Write-Host " FastAPI Processing Simulator - Client Runner" -ForegroundColor Cyan Write-Host "================================================" -ForegroundColor Cyan Write-Host "" # Check if Python is available try { $pythonVersion = python --version 2>$null Write-Host "✅ Found Python: $pythonVersion" -ForegroundColor Green } catch { Write-Host "❌ Error: Python is not installed or not in PATH" -ForegroundColor Red Write-Host "Please install Python and try again." Read-Host "Press Enter to exit" exit 1 } # Check if websockets module is available try { python -c "import websockets" 2>$null if ($LASTEXITCODE -ne 0) { throw "websockets not found" } Write-Host "✅ WebSockets module is available" -ForegroundColor Green } catch { Write-Host "📦 Installing required websockets module..." -ForegroundColor Yellow pip install websockets if ($LASTEXITCODE -ne 0) { Write-Host "❌ Error: Failed to install websockets module" -ForegroundColor Red Read-Host "Press Enter to exit" exit 1 } Write-Host "✅ WebSockets module installed successfully" -ForegroundColor Green } function Show-Menu { Write-Host "" Write-Host "Select an option:" -ForegroundColor Yellow Write-Host "1. Interactive mode (default)" -ForegroundColor White Write-Host "2. Quick test (sample data)" -ForegroundColor White Write-Host "3. Stress test (5 concurrent requests)" -ForegroundColor White Write-Host "4. Custom automated test" -ForegroundColor White Write-Host "5. Show help" -ForegroundColor White Write-Host "6. Exit" -ForegroundColor White Write-Host "" } function Start-InteractiveMode { Write-Host "" Write-Host "🚀 Starting interactive mode..." -ForegroundColor Green python client.py --interactive } function Start-QuickTest { Write-Host "" Write-Host "⚡ Running quick test with sample data..." -ForegroundColor Green python client.py --folder "sample-folder" --env "production" Read-Host "Press Enter to continue" } function Start-StressTest { Write-Host "" Write-Host "💪 Running stress test with 5 concurrent requests..." -ForegroundColor Green python client.py --stress 5 Read-Host "Press Enter to continue" } function Start-CustomTest { Write-Host "" $folder = Read-Host "Enter folder name" $env = Read-Host "Enter environment" $url = Read-Host "Enter WebSocket URL (or press Enter for default)" Write-Host "" Write-Host "🔧 Running custom test..." -ForegroundColor Green if ([string]::IsNullOrWhiteSpace($url)) { python client.py --folder $folder --env $env } else { python client.py --url $url --folder $folder --env $env } Read-Host "Press Enter to continue" } function Show-Help { Write-Host "" Write-Host "📖 Help - Available Commands:" -ForegroundColor Cyan Write-Host "" Write-Host "Manual Usage:" -ForegroundColor Yellow Write-Host " python client.py --interactive" -ForegroundColor White Write-Host " python client.py --folder 'test' --env 'dev'" -ForegroundColor White Write-Host " python client.py --stress 10" -ForegroundColor White Write-Host " python client.py --url 'ws://other-server:8000/ws' --folder 'data' --env 'prod'" -ForegroundColor White Write-Host "" Write-Host "Features:" -ForegroundColor Yellow Write-Host " • Interactive mode with menu-driven interface" -ForegroundColor White Write-Host " • Automated testing with custom parameters" -ForegroundColor White Write-Host " • Stress testing with concurrent requests" -ForegroundColor White Write-Host " • Real-time progress monitoring" -ForegroundColor White Write-Host " • Comprehensive error handling" -ForegroundColor White Write-Host "" Read-Host "Press Enter to continue" } # Main loop do { Show-Menu $choice = Read-Host "Enter your choice (1-6)" switch ($choice) { "1" { Start-InteractiveMode } "2" { Start-QuickTest } "3" { Start-StressTest } "4" { Start-CustomTest } "5" { Show-Help } "6" { Write-Host "" Write-Host "👋 Goodbye!" -ForegroundColor Green exit 0 } "" { Start-InteractiveMode } default { Write-Host "❌ Invalid choice. Please try again." -ForegroundColor Red } } } while ($true)