Perhaps by (mis)using some legacy API?
Are there browser plugins that can do this?
I am in a controlled environment, so solutions involving browser plugins or browser modifications are welcome.
Background:
I have some JS running in an embedded JavaScript VM, using custom methods exposed from C++. These custom methods are synchronous (there is no need for them to be asynchronous).
For testing and development, I want to be able to run the same JS code in the browser. As the browser does not have my custom C++ methods, I need to call them remotely.
Today, I’m using a blocking XMLHttpRequest (deprecated in most browsers, but still works) to do this.
The problem is that making an HTTP-request has some overhead and is relatively slow (in the 20-50 ms range). WebSockets are much faster (roundtrip in a few ms), but as they are inherently asynchronous, I can’t use it to replace my blocking functions.