onProcessMessageReceived not called

Having problems with building or using CEF's C/C++ APIs? This forum is here to help. Please do not post bug reports or feature requests here.

onProcessMessageReceived not called

Postby Nidhi » Mon Jan 16, 2017 8:38 am

I am using separate sub-process executable approach for my application.
When I am passing the messages at runtime using CefProcessMessage, it is observed that OnProcessMessageReceived function in render process is not called.
Do I need to pass the message using command line when I am mentioning the sub process path?
Nidhi
Techie
 
Posts: 48
Joined: Fri Sep 02, 2016 6:23 am

Re: onProcessMessageReceived not called

Postby magreenblatt » Tue Jan 17, 2017 11:37 am

How did you verify that OnProcessMessageReceived is not called? Are you passing a CefApp instance to CefExecuteProcess and implementing CefApp::GetRenderProcessHandler?
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: onProcessMessageReceived not called

Postby Nidhi » Tue Jan 17, 2017 12:30 pm

yes, the issue arrives when I am using sub process executable method while it is working fine for single process.
Nidhi
Techie
 
Posts: 48
Joined: Fri Sep 02, 2016 6:23 am

Re: onProcessMessageReceived not called

Postby magreenblatt » Tue Jan 17, 2017 1:19 pm

You didn't answer the question:

How did you verify that OnProcessMessageReceived is not called?
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: onProcessMessageReceived not called

Postby Nidhi » Thu Jan 19, 2017 8:02 am

I have implemented the render process in my sub-executable process. We are trying to implement a chat system using CEF where on button click a message is passed to CEF process, the code is mentioned below:-
Code: Select all
void sendMessagetoRender(std::string js_string)
  {
     CefRefPtr<CefProcessMessage> msg = CefProcessMessage::Create(js_string);
     CefRefPtr<CefListValue> args = msg->GetArgumentList();
     args->SetString(0, "my string");
     args->SetInt(0, 10);
     SimpleHandler* simpleglobalHandler = SimpleHandler::GetInstance();
     CefRefPtr<CefBrowser> browser = simpleglobalHandler->GetBrowser();
     browser->SendProcessMessage(PID_RENDERER, msg);
  }

Now when I am debugging the code, it is observed that onProcessMessageReceived for render process which is implemented in sub executable process is not called.

My next question might sound very wasteful, but please let me know, when I am receiving the string from render process to browser process how will I send the data back to my native application because the onProcessMessageReceived in browser process will return bool value. Please help me.
Nidhi
Techie
 
Posts: 48
Joined: Fri Sep 02, 2016 6:23 am

Re: onProcessMessageReceived not called

Postby amaitland » Thu Jan 19, 2017 8:56 am

It's still not clear you've answered the question. Are you specifically attaching the debugger to the sub process?

You can use the renderer-startup-dialog command line argument to help attach the debugger.
Maintainer of the CefSharp project.
amaitland
Virtuoso
 
Posts: 1292
Joined: Wed Jan 14, 2015 2:35 am

Re: onProcessMessageReceived not called

Postby Nidhi » Thu Jan 19, 2017 9:03 am

Yes, I have specifically attached the debugger to the render/sub-process
Nidhi
Techie
 
Posts: 48
Joined: Fri Sep 02, 2016 6:23 am

Re: onProcessMessageReceived not called

Postby amaitland » Thu Jan 19, 2017 4:07 pm

Great. Make sure your passing an instance of `CefApp` to `CefExecuteProcess` and `CefApp::GetRenderProcessHandler` returns an instance of your `CefRenderProcessHandler`.
Maintainer of the CefSharp project.
amaitland
Virtuoso
 
Posts: 1292
Joined: Wed Jan 14, 2015 2:35 am

Re: onProcessMessageReceived not called

Postby Nidhi » Mon Jan 23, 2017 4:04 am

I already did that. So the issue occurs when I am passing runtime message not the startup message.
Nidhi
Techie
 
Posts: 48
Joined: Fri Sep 02, 2016 6:23 am

Re: onProcessMessageReceived not called

Postby amaitland » Mon Jan 23, 2017 5:40 am

Firstly you should be clearer when asking a question, include what you've tried and what works. Secondly what is a start-up message? You can append command line arhs that are passed to a subprocess, it's not related to sendprocessmessage
Maintainer of the CefSharp project.
amaitland
Virtuoso
 
Posts: 1292
Joined: Wed Jan 14, 2015 2:35 am

Next

Return to Support Forum

Who is online

Users browsing this forum: No registered users and 21 guests