Remote Method Invocation (RMI) Flow

System Design · flowchart diagram · NOASSERTION

Illustrates the Remote Method Invocation (RMI) process between a Main Process and a WebView, detailing message exchange via postMessage for method calls.

Source: https://github.com/laurent22/joplin/blob/7f55a566e5a95e24cbfd7792cd7baf07ba46dc10/readme/dev/spec/plugins.md
Curated by laurent22
RMI IPC postMessage WebView System Communication Flowchart Message Passing

Mermaid source

flowchart
	postMessage(["postMessage({ kind: InvokeMethod, ... })"])
	rm1--2-->postMessage--3-->rm2
	subgraph MainProcess
		callMethod(["await m1.remoteApi.setCss('...')"])
		callMethod--1-->rm1
		rm1["m1 = RemoteMessenger< MainProcessApi,WebViewApi >"]
	end
	subgraph WebView
		rm2["RemoteMessenger< WebViewApi,MainProcessApi >"]
		webViewApiImpl["webViewApiImpl.setCss"]
		rm2--4-->webViewApiImpl
	end

What this diagram shows

The sequence of events for a remote method call from a Main Process to a WebView, utilizing RemoteMessenger instances and postMessage for inter-process communication. It highlights the invocation, message serialization, and execution within the target process.

When to use it

To explain how different isolated processes or components (like a main application and an embedded web view) communicate and invoke methods on each other, especially in desktop applications or environments with sandboxed components.

How to adapt it for your project

Modify the process names (e.g., "Client" and "Server", "Host" and "Plugin"). Change the specific method being called (setCss) to reflect the actual remote operation. Add error handling paths or different message types for more complex scenarios.

Key concepts