Skip to main content

Crate rpfm_ipc

Crate rpfm_ipc 

Source
Expand description

§RPFM IPC - Inter-Process Communication Protocol

This crate defines the IPC protocol used for communication between the RPFM frontend and the backend server (rpfm_server). It provides type-safe message definitions that ensure consistent communication between the two processes.

§Protocol Overview

The communication follows a request-response pattern over WebSocket connections:

  1. The frontend creates a messages::Message<Command> with a unique ID
  2. The message is serialized to JSON and sent over WebSocket to the server
  3. The server processes the command and sends back a messages::Message<Response>
  4. The frontend matches the response ID to the original request

This ID correlation mechanism enables asynchronous, non-blocking communication where multiple requests can be in flight simultaneously.

§Modules

§Usage

This crate is not intended for standalone use. It serves as a shared dependency between rpfm_server and rpfm_ui, providing the common language they need to communicate.

§Example Message Flow

// Frontend creates a command
let command = Message {
    id: 1,
    data: Command::OpenPackFiles(vec![PathBuf::from("/path/to/pack.pack")]),
};

// Serialize and send over WebSocket...

// Server responds with matching ID
let response = Message {
    id: 1,  // Same ID as the request
    data: Response::ContainerInfo(container_info),
};

Modules§

helpers
IPC Helpers Module
messages
IPC Messages Module
settings_keys
Typed constants for all settings keys used across the application.