Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

163
Views
Is there a way to block while waiting for a websocket response in the browser?

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.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!