Multithreading with a websocket client and a simulation: how to block a thread?

This page summarizes the projects mentioned and recommended in the original post on /r/node

Our great sponsors
  • SurveyJS - Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • WorkOS - The modern identity platform for B2B SaaS
  • jsdom

    A JavaScript implementation of various web standards, for use with Node.js

  • I am using jsdom to run a simulation. This simulation needs to communicate through a websocket with a Python server I have. I am using websocket client. My problem is that I need to immediately block the simulation at certain points until I have received a message from the server through the websocket, and then continue synchronously from where the simulation was blocked. The websocket client and the jsdom threads must be able to pass data to each other. I have looked at worker_threads but they are not very clear to me and I can't find anything about suspending threads without terminating them. Any suggestions on approaches to take?

  • SurveyJS

    Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App. With SurveyJS form UI libraries, you can build and style forms in a fully-integrated drag & drop form builder, render them in your JS app, and store form submission data in any backend, inc. PHP, ASP.NET Core, and Node.js.

    SurveyJS logo
NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts