RemoteMessenger Initialization Flow

System Design · flowchart diagram · NOASSERTION

Illustrates the initial communication flow between MainProcess and WebView using RemoteMessenger for readiness signaling.

Source: https://github.com/laurent22/joplin/blob/7f55a566e5a95e24cbfd7792cd7baf07ba46dc10/readme/dev/spec/plugins.md
Curated by laurent22
IPC Main Process WebView Communication Mermaid Flowchart Joplin

Mermaid source

flowchart
	postMessage1(["postMessage({ kind: RemoteReady, ... })"])
	rm1--1-->postMessage1--2-->rm2
	subgraph MainProcess
		rm1["m1 = RemoteMessenger< MainProcessApi,WebViewApi >"]
	end
	subgraph WebView
		rm2["RemoteMessenger< WebViewApi,MainProcessApi >"]
	end

What this diagram shows

This diagram depicts the initial handshake mechanism for RemoteMessenger between a MainProcess and a WebView. It specifically shows rm1 in the Main Process sending a RemoteReady message via postMessage to rm2 in the WebView, initiating communication.

When to use it

Use this pattern when establishing secure and synchronized communication channels between different isolated processes or contexts, such as a main application process and an embedded web view, ensuring both sides are ready before exchanging application-specific data.

How to adapt it for your project

This pattern can be adapted by adding acknowledgments, error handling, or versioning to the RemoteReady message. For more complex setups, consider a dedicated message broker or a more robust RPC mechanism. The RemoteMessenger can be extended to support various message kinds for different functionalities.

Key concepts