Ask coding questions

← Back to all posts
How to multi thread in node.js
Legendthecoder

So I have been trying to recreate this console game engine I have made python (the link to it: https://replit.com/@Legendthecoder/List-game-engine-test-3?v=1)
to node.js but I need to use multithreading so things like the physics, controls, and the frames to work at the same time, I tried to search up how to do multithreading is node.js but it's too hard to understand, also I am a beginner

Answered by CodingElf66 [earned 5 cycles]
View Answer
Voters
Legendthecoder
Comments
hotnewtop
CodingElf66

Use Socket IO.

Legendthecoder

@CodingElf66 thanks but what is that and how to use it

CodingElf66

@Legendthecoder Ok, I'll show you!

That's how you import it. If you want to know how to USE it however, go check out this tutorial!

https://replit.com/talk/learn/SocketIO-Tutorial-What-its-for-and-how-to-use/143781

Legendthecoder

@CodingElf66 alright, can I make the threads change the variable values and stuff?

CodingElf66

@Legendthecoder Yes you can! I have a chat you can view, it uses Socket IO. You can view the code and see how it works!

Output: https://socket-io.codingelf66.repl.co/

Code: https://replit.com/@CodingElf66/Socket-IO

CodingElf66

@Legendthecoder If you don't mind, can you mark it as answered? That way, people who look at this post will also know the answer. Because based on my knowledge, Socket IO can actually be complicated.

Legendthecoder

@CodingElf66 ok thank you very much! Hope this don't sound kiddy but do you wanna talk sometime?

Legendthecoder

@CodingElf66 Also how do I mark it as answered?

CodingElf66
CodingElf66

@Legendthecoder There is a check mark next to my answer. Just click on it.

Legendthecoder

@CodingElf66 oh dang I didn't see that, Ok Ill click it

CodingElf66
Legendthecoder

@CodingElf66 Your welcome