Disclosure Statement: This site contains affiliate links, which means that I may receive a commission if you make a purchase using these links. As an eBay Partner, I earn from qualifying purchases.

retrieve response body in thread

Post Reply
X11
Posts: 49
Joined: Thu Jul 25, 2019 10:15 am

retrieve response body in thread

Post by X11 »

Hi.
Sory for my english :oops:

I am studying an demo example "ResponseFilterBrowser".
Example uses windows messaging api (Winapi.Messages).
But i use Tchromium in windows less mode in a separate thread without windows.
How can i retrieve response body in thread?

Thanx.
You do not have the required permissions to view the files attached to this post.
User avatar
salvadordf
Posts: 4016
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: retrieve response body in thread

Post by salvadordf »

Hi,

The same way you do with a normal browser.

TChromium events will be executed in CEF threads and you will have to store the body contents in a variable protected by a critical section.
After that, send a message to the thread that will handle the body contents with PostThreadMessage :
https://stackoverflow.com/questions/139 ... hin-thread

I've never used it but some people recommend OmniThreadLibrary to simplify thread handling :
https://otl.17slon.com/
X11
Posts: 49
Joined: Thu Jul 25, 2019 10:15 am

Re: retrieve response body in thread

Post by X11 »

But is there no other way, without windows messaging api (Winapi.Messages)?
X11
Posts: 49
Joined: Thu Jul 25, 2019 10:15 am

Re: retrieve response body in thread

Post by X11 »

Can I use TCEFUrlRequestClientComponent in thread without Winapi.Messages?
User avatar
salvadordf
Posts: 4016
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: retrieve response body in thread

Post by salvadordf »

I've never tried this with that component but in theory you can set GlobalCEFApp.MultiThreadedMessageLoop to false, GlobalCEFApp.ExternalMessagePump to true and use the GlobalCEFWorkScheduler.

With that configuration the browser process message loop runs in the same thread.

The ExternalPumpBrowser demo has all the code you need to use the GlobalCEFWorkScheduler but I'm not sure it will work with TCEFUrlRequestClientComponent.
X11
Posts: 49
Joined: Thu Jul 25, 2019 10:15 am

Re: retrieve response body in thread

Post by X11 »

It would be very nice if you added one more parameter to the OnResourceResponse Event - ResponseBody :roll:
User avatar
salvadordf
Posts: 4016
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: retrieve response body in thread

Post by salvadordf »

I'm sorry but I can only add the parameters given by the CEF API and ICefResourceRequestHandler.OnResourceResponse doesn't have a "ResponseBody".
Post Reply