Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to signal yourself in Node.js?

I know it's possible to send SIGTERM, SIGINT, etc. to your own process in the C programming language:

https://www.gnu.org/software/libc/manual/html_node/Signaling-Yourself.html

Does Node.js provide this functionality?

like image 685
Shivanshu Goyal Avatar asked Apr 13 '17 20:04

Shivanshu Goyal


People also ask

Is NodeJS good for networking?

Node. js is a single-threaded, open-source, cross-platform runtime environment for building fast and scalable server-side and networking applications. It runs on the V8 JavaScript runtime engine, and it uses event-driven, non-blocking I/O architecture, which makes it efficient and suitable for real-time applications.

What node is not good for?

Not Suitable for Heavy-Computing Apps Node. js doesn't support multi-threaded programming yet. It is able to serve way more complicated applications than Ruby, but it's not suitable for performing long-running calculations. Heavy computations block the incoming requests, which can lead to decrease of performance .

CAN NodeJS handle high traffic?

Since Node. js uses non-blocking IO, the server can handle multiple requests without waiting for each one to complete, which means Node. js can handle a much higher volume of web traffic than other more traditional languages.

Is NodeJS good for beginners?

For a beginner who wants to get started in the tech industry, learning Node. js and getting relevant certifications can be an effective way to get your career launched. Use the advice above to start your journey, and soon you'll be proficient in this popular (and profitable) runtime environment.


1 Answers

process.kill(process.pid, "SIGINT");

process.kill sends a signal (SIGINT in this case, provided by the second parameter), to a provided PID. (process.pid in this case, which is the PID of the running node process.)

Source: https://nodejs.org/api/process.html#process_process_kill_pid_signal

like image 140
skiilaa Avatar answered Oct 13 '22 22:10

skiilaa