A bridge application that connects flight simulators using the ForeFlight Protocol to the Shirley protocol for flight instruments.
Fly Shirley - AI Copilot, Trainer and Assistant (https://airplane.team/)
This application allows any flight simulator that supports ForeFlight's UDP protocol to connect to Shirley-compatible flight instruments. It acts as a protocol converter and data bridge between the two systems.
It was developed to be used with Aerofly FS4 Flight Simulator from IPACS (TM).
- Receives UDP data packets from flight simulators (on port 49002) using ForeFlight's protocol
- Hosts a WebSocket server (on port 2992) using Shirley's protocol
- Performs all necessary unit conversions (meters to feet, m/s to knots, etc.)
- Provides both a GUI mode and CLI mode for operation
- Real-time display of flight data in the GUI
- Python 3.7 or higher
- Required packages:
websockets(installed via pip)- Standard library modules:
asyncio,tkinter,socket,json,threading,logging
- Clone this repository:
git clone https://github.com/yourusername/ForeFlight-Shirley-Bridge.git
cd ForeFlight-Shirley-Bridge- Install the required dependencies:
pip install -r requirements.txtNote: tkinter is usually included with Python installation. If not available, install it using your system package manager:
- Ubuntu/Debian:
sudo apt-get install python3-tk - macOS: Included with Python from python.org
- Windows: Included with standard Python installation
Run the application with the graphical interface:
python ForeFlight-Shirley-Bridge.pyThe GUI displays:
- Connection status (red/green indicator)
- Real-time flight data (position, altitude, speed, attitude)
- Server information (UDP and WebSocket endpoints)
Run the application in command-line interface mode:
python ForeFlight-Shirley-Bridge.py --cli# Run with custom ports
python ForeFlight-Shirley-Bridge.py --cli --udp-port 50000 --ws-port 3000
# Run with debug logging
python ForeFlight-Shirley-Bridge.py --cli --log-level DEBUG
# Save logs to file
python ForeFlight-Shirley-Bridge.py --cli --log-file bridge.log
# Custom WebSocket configuration
python ForeFlight-Shirley-Bridge.py --ws-host localhost --ws-port 8080 --ws-path /api/v2
# View all options
python ForeFlight-Shirley-Bridge.py --helpYou can also configure the bridge using environment variables:
# Linux/macOS
export FF_SHIRLEY_UDP_PORT=50000
export FF_SHIRLEY_WS_PORT=3000
export FF_SHIRLEY_LOG_LEVEL=DEBUG
export FF_SHIRLEY_LOG_FILE=bridge.log
python ForeFlight-Shirley-Bridge.py --cli
# Windows (PowerShell)
$env:FF_SHIRLEY_UDP_PORT=50000
$env:FF_SHIRLEY_WS_PORT=3000
python ForeFlight-Shirley-Bridge.py --cliAvailable environment variables:
FF_SHIRLEY_UDP_PORT- UDP port for ForeFlight data (default: 49002)FF_SHIRLEY_WS_HOST- WebSocket server host (default: 0.0.0.0)FF_SHIRLEY_WS_PORT- WebSocket server port (default: 2992)FF_SHIRLEY_WS_PATH- WebSocket server path (default: /api/v1)FF_SHIRLEY_LOG_LEVEL- Logging level: DEBUG, INFO, WARNING, ERROR, CRITICAL (default: INFO)FF_SHIRLEY_LOG_FILE- Optional log file path
The bridge expects ForeFlight-compatible UDP packets on port 49002:
- XGPS:
XGPS<sim_name>,<longitude>,<latitude>,<altitude_msl_meters>,<track_true_north>,<groundspeed_m/s> - XATT:
XATT<sim_name>,<true_heading>,<pitch_degrees>,<roll_degrees>
Reference: ForeFlight Connect API
Data is served via WebSocket (ws://0.0.0.0:2992/api/v1) in JSON format:
{
"position": {
"latitudeDeg": float,
"longitudeDeg": float,
"mslAltitudeFt": float,
"gpsGroundSpeedKts": float
},
"attitude": {
"rollAngleDegRight": float,
"pitchAngleDegUp": float,
"trueHeadingDeg": float
}
}Reference: Sim Interface - Airplane-Team FlyShirley
Aerofly FS4 supports the ForeFlight protocol natively. To enable it:
- Open Aerofly FS4
- Go to Settings → General
- Enable "Send Flight Data to ForeFlight" or similar option
- The simulator will broadcast UDP packets on port 49002 (default)
- Start the bridge application
- Start flying in Aerofly FS4
The bridge will automatically detect and process the data.
Any flight simulator that supports the ForeFlight protocol can work with this bridge. Common simulators include:
- X-Plane: Install the ForeFlight Link plugin
- Microsoft Flight Simulator: Use third-party ForeFlight bridge tools
- Prepar3D/FSX: Install FSUIPC with ForeFlight support
Possible causes and solutions:
-
Simulator not sending data
- Verify ForeFlight protocol is enabled in your simulator settings
- Check that the simulator is running and in flight
- Restart the simulator after enabling ForeFlight support
-
Port conflict
- Ensure no other application is using port 49002 (UDP)
- Check with:
netstat -an | grep 49002(Linux/macOS) ornetstat -an | findstr 49002(Windows) - Use a different port:
python ForeFlight-Shirley-Bridge.py --cli --udp-port 50000
-
Firewall blocking
- Allow UDP port 49002 in your firewall
- Allow the Python executable through your firewall
- On Windows: Check Windows Defender Firewall settings
-
Network interface issues
- If running simulator on a different computer, use
--ws-hostto specify the correct IP - Ensure both devices are on the same network
- If running simulator on a different computer, use
Possible causes and solutions:
-
Port not accessible
- Verify WebSocket server is running: check the console logs
- Ensure port 2992 (default) is not blocked by firewall
- Try connecting to
ws://localhost:2992/api/v1first
-
Wrong URL or path
- The default WebSocket URL is
ws://0.0.0.0:2992/api/v1 - Verify you're using the correct path (
/api/v1) - Check console output for the actual WebSocket URL being served
- The default WebSocket URL is
-
Network binding issues
- Try binding to localhost only:
--ws-host localhost - Or bind to a specific IP:
--ws-host 192.168.1.100
- Try binding to localhost only:
Possible causes:
- Corrupted or invalid data from the simulator
- The bridge includes data validation and will reject invalid values:
- Latitude: -90° to 90°
- Longitude: -180° to 180°
- Altitude: -500m to 50,000m
- Pitch: -90° to 90°
- Roll: -180° to 180°
- Ground speed: 0 to 350 m/s (~680 knots)
Solution: Check simulator data quality. Use --log-level DEBUG to see detailed validation messages.
Possible causes and solutions:
-
Too many log messages
- Reduce logging level:
--log-level WARNINGor--log-level ERROR - Default is INFO which is reasonable for most cases
- Reduce logging level:
-
Debug mode enabled
- Don't use
--log-level DEBUGin production - DEBUG mode logs every single packet
- Don't use
If you encounter issues:
- Run with debug logging:
python ForeFlight-Shirley-Bridge.py --cli --log-level DEBUG --log-file debug.log - Check the log file for error messages
- Verify your simulator is actually sending ForeFlight protocol data
- Open an issue on GitHub with:
- Your Python version (
python --version) - Your operating system
- Simulator name and version
- Debug log file
- Exact command line used
- Your Python version (
The bridge tracks the following statistics (visible in CLI mode with INFO or DEBUG logging):
- UDP Server: Packets received, XGPS count, XATT count, error count
- WebSocket Server: Total connections, messages sent, send errors, active connections
- Data Validation: Invalid data warnings (when data is out of acceptable ranges)
To view detailed statistics, run with DEBUG logging:
python ForeFlight-Shirley-Bridge.py --cli --log-level DEBUGThis software is released under the MIT License. See the LICENSE file for details.
Contributions are welcome! Please feel free to submit a Pull Request.
Copyright (c) 2025 Juan Luis Gabriel