PoixsDesk Project Documentation

跨平台Desk

PoixsDesk Project Documentation

📖 Project Introduction

PoixsDesk is a remote desktop/cloud computer system based on WebRTC technology, supporting remote access and control of Windows desktops through web browsers. The system implements low-latency screen sharing, audio/video transmission, and bidirectional input control functionality.

Cloud Computer Architecture

✨ Core Features

1. Real-time Screen Sharing

2. Synchronized Audio/Video Transmission

3. Remote Input Control

4. Bidirectional Data Transmission

5. WebSocket Signaling

🏗️ System Architecture

Overall Architecture

┌──────────────┐         ┌──────────────┐
│  Web Client  │◄───────►│ Desktop App  │
│              │         │              │
│ - Browser    │         │ - Screen     │
│   Player     │         │   Capture    │
│ - Input Ctrl │         │ - A/V Encode │
└──────┬───────┘         └──────┬───────┘
       │                        │
       │   WebSocket Signaling  │
       │◄──────────────────────►│
       │                        │
       │   WebRTC Media Stream  │
       │◄──────────────────────►│
       │                        │

Module Composition

For detailed architecture documentation, please refer to ARCHITECTURE_EN.md

📦 Project Structure

PoixsDesk/
├── libcommon/              # Common library module
│   ├── client.h/cpp        # RTC client
│   ├── crtc_publisher.h/cpp # RTC publisher
│   ├── cinput_device.h/cpp # Input device management
│   ├── cdesktop_capture.h/cpp # Desktop capture
│   ├── cdata_channel.h/cpp # Data channel
│   └── ...
├── libdevice/              # Device control module
│   └── window/
│       ├── device.h/cpp    # Input device control
│       └── misc.h/cpp      # Helper functions
├── PoixsDesk/              # Main program
│   └── main.cpp            # Program entry point
├── Win/                    # Windows GUI program
├── Tools/                  # Tool programs
├── www/                    # Web frontend
└── build/                  # Build directory

🚀 Quick Start

Requirements

Build Steps

  1. Clone the repository
    git clone <repository_url>
    cd PoixsDesk
    
  2. Prepare WebRTC dependencies
    • Download and compile Google WebRTC source code
    • Configure WebRTC path in CMakeLists.txt
  3. Configure CMake
    mkdir build
    cd build
    cmake .. -DWebRTC_ROOT=D:/Work/webrtc_google/src
    
  4. Build the project
    cmake --build . --config Release
    
  5. Run the program
    ./PoixsDesk/PoixsDesk.exe ws://localhost:8080/rtc
    

Runtime Parameters

📖 Usage Instructions

Desktop Client Configuration

  1. Start the desktop application
    PoixsDesk.exe ws://your-signaling-server/rtc
    
  2. The program will automatically
    • Connect to the signaling server
    • Create WebRTC connection
    • Start capturing desktop and audio
    • Wait for client connections

Web Client Usage

  1. Open browser
    • Visit http://your-server/player.html
  2. Connect to desktop
    • Enter room name and username
    • Click connect button
  3. Remote control
    • Use mouse for clicking and moving
    • Use keyboard for input
    • Use mouse wheel for scrolling

Windows Service Mode

You can run in Windows service mode for auto-start on boot:

# Install service
PoisxDeskService.exe install

# Start service
PoisxDeskService.exe start

# Stop service
PoisxDeskService.exe stop

🔧 Configuration

Video Encoding Configuration

In crtc_publisher, you can configure:

Audio Encoding Configuration

Network Configuration

📝 API Documentation

RTC Client API

Initialize Client

chen::crtc_client client;
client.init(0);  // gpu_index: GPU index
client.Loop("ws://localhost:8080/rtc");  // Connect to signaling server

Client State

enum ERtc_Type {
    ERtc_None,              // Not initialized
    ERtc_WebSocket_Init,    // WebSocket initializing
    ERtc_WebSocket,         // WebSocket connected
    ERtc_WebSocket_Wait,    // Waiting for response
    ERtc_Destory,           // Destroying
    ERtc_Exit               // Exiting
};

Input Device API

Mouse Control

// Absolute mouse movement
chen::abs_mouse(event, x, y);

// Relative mouse movement
chen::move_mouse(event, deltaX, deltaY);

// Mouse button
chen::button_mouse(event, x, y, button, release);
// button: 0=left, 1=middle, 2=right, 3+=extended

Keyboard Control

// Key press/release
chen::keyboard_update(event, vk_code, release, flags);
// vk_code: virtual key code
// release: true=release, false=press

🔍 Troubleshooting

Common Issues

1. Input Events Invalid

Problem: Mouse or keyboard input cannot control remote desktop

Solutions:

2. Video Not Displaying

Problem: Web client cannot see desktop screen

Solutions:

3. High Latency

Problem: Remote operations have noticeable delay

Solutions:

4. Audio Issues

Problem: No sound or audio stuttering

Solutions:

Debug Tools

🔒 Security Recommendations

Authentication and Authorization

Data Encryption

Input Validation

🤝 Contributing

Code Standards

Contribution Process

  1. Fork the project
  2. Create feature branch
  3. Commit changes
  4. Create Pull Request

📄 License

Please see the LICENSE file for detailed license information.

👥 Author

🙏 Acknowledgments

🐛 Issue Reporting

If you encounter problems or have suggestions, please report through:

🔮 Future Plans

Feature Enhancements

Platform Extensions

Performance Optimization


Last Updated: 2025-01-XX
Version: 1.0