When using CEF3 as a framework development process, WebSockets, XMLHttpRequest, JS, and local client interactions are required to deliver messages in the render process and in the browse (Browser) session. CEF3 is well encapsulated in this area, and the average user can implement interprocess messaging with only a few interfaces and functions to understand. According to the personal development experience and understanding, take cefclient as an example to summarize the CEF3 message transmission mechanism, there is not correct, please enlighten!
The Cefbrowser::sendprocessmessage () method is typically called through the specified Cefbrowser instance. Because the cefbrowser and cefframe objects exist in both the browser and render processes, both the render process and the browse (browser) process can be called to the Sendprocessmessage () method. Sendprocessmessage () has two parameters, the process identifies the CEFPROCESSID with the message that needs to be passed cefprocessmessage.
Cefprocessid is an enumeration constant, and the meaning of the specific representation is not explained, see the code shown below:
typedef enum { /// //Browser process. Pid_browser,//// Renderer process. Pid_renderer,} cef_process_id_t;
Cefprocessmessage is a class that manages the delivery of messages, including the message name and message content. See the code example below:
Cefrefptr<cefprocessmessage> message = Cefprocessmessage::create (cefstring ("Xiaoximingcheng")); Set message name cefrefptr<ceflistvalue> args = Message->getargumentlist (); Cefstring Message_cont; Args->setstring (0, Message_cont); Set message content
Messages are passed between processes, and are set by Getargumentlist and SetString. All render processes provide access to the same message passing through the browser process
Cefbrowserprocesshandler::onrenderprocessthreadcreated () passing messages to cefrenderprocesshandler::o in the render process Nrenderthreadcreated ().
messages sent from the browser process to The render process are received by cefrenderprocesshandler::onprocessmessagereceived (), messages sent from the render process to the browser process are received by the cefbrowserprocesshandler::onprocessmessagereceived (). See:
before the process of sending a message is received via the associated message and frame ID(via Cefframe::getidentifier ()), the receiving message process is Cefbrowser::getframe () gets frame-related information so that the frame and message correspond so that each frame can handle its own messages.
Inter-process messaging in the CEF3 developer series