Replies: 1 comment 7 replies
-
This kind of sounds like an XY problem. Are you sure you need to be using a thread per client? That sounds like a lot of work to manage and you'll need to maintain work queues, delegation, scheduling etc. Deno, like Node.js and all other JS, uses an event loop that allows you to skip the work of multithreading management and let libuv (or whatever the event loop implementation is) handle it for you. Node will use multiple cores for a basic HTTP server, but that is abstracted away from you. See here: https://stackoverflow.com/questions/49141259/does-a-nodejs-server-use-multithreading |
Beta Was this translation helpful? Give feedback.
7 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm trying to write a simple tcp server. Is there a way to give each client their own thread?
I doesn't actually have to be OS threads. Go's go routines or dart's isolates will work just as well. As long as multiple cores and cpus are being utilized.
I see that I can use web workers. However, every example I have seen shows that I need to pass the name of a source file to the constructor, which this worker then executes. I want to pass in a socket or some other js/ts object, not a source file.
Am I missing something?
Beta Was this translation helpful? Give feedback.
All reactions