I have managed to send message from a chrome extension to a native (C++) app thanks to the good folks of stack overflow. Once the native host app receives the message, it can return any response data. However, this is in response to the native app receiving data from the extension. Also, the message sent by the extension is not synchronous and therefore the extension doesn't wait for a response from the host app.
My requirement is to initiate the comms connection from the native app i.e. my native app will periodically send updates to the chrome extension. Is there any mechanism to initiate the message sending from the native app and pass it to the appropriate chrome extension?
I basically want to achieve the following: I want to post a message on events like webRequest.OnBeforeSendHeaders and I want the response to the message to decide if I should block the url request. If the receiving of the response is going to be on a callback, this will mostly be on a different thread and that will not allow me to wait for the response on the webRequest.OnBeforeSendHeaders thread. Is there a way I can pause the webRequest.OnBeforeSendHeaders while I wait for the native app to respond to my request? Or can webRequest.OnBeforeSendHeaders peek into the message buffer (in a loop) to see if the native app has responded?
Or is there an alternative way to achieve this?