#!/bin/bash # Script to run both the SigSocket web app and client app and open them in the browser # Set the base directory BASE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" WEB_APP_DIR="$BASE_DIR/web_app" CLIENT_APP_DIR="$BASE_DIR/client_app" # Colors for terminal output GREEN='\033[0;32m' YELLOW='\033[1;33m' NC='\033[0m' # No Color # Function to kill background processes on exit cleanup() { echo -e "${YELLOW}Stopping all processes...${NC}" kill $(jobs -p) 2>/dev/null exit 0 } # Set up cleanup on script termination trap cleanup INT TERM EXIT echo -e "${GREEN}Starting SigSocket Demo Applications...${NC}" # Start the web app in the background echo -e "${GREEN}Starting Web App (http://127.0.0.1:8080)...${NC}" cd "$WEB_APP_DIR" && cargo run & # Wait for the web app to start (adjust time as needed) echo "Waiting for web app to initialize..." sleep 5 # Start the client app in the background echo -e "${GREEN}Starting Client App (http://127.0.0.1:8082)...${NC}" cd "$CLIENT_APP_DIR" && cargo run & # Wait for the client app to start echo "Waiting for client app to initialize..." sleep 5 # Open browsers (works on macOS) echo -e "${GREEN}Opening browsers...${NC}" open "http://127.0.0.1:8080" # Web App sleep 1 open "http://127.0.0.1:8082" # Client App echo -e "${GREEN}SigSocket demo is running!${NC}" echo -e "${YELLOW}Press Ctrl+C to stop all applications${NC}" # Keep the script running until Ctrl+C wait