Node.js Process disconnect Event Last Updated : 28 Apr, 2025 Summarize Comments Improve Suggest changes Share Like Article Like Report In this article, we will discuss about the disconnect event of the Process object. The disconnect event will be issued when the IPC channel is closed if the Node.js process was started using an IPC channel. Syntax: process.on('disconnect', () => { // Disconnect event }); The below examples illustrate the use of the Process disconnect event property in Node.js: Example 1: Filename: parent.js JavaScript // Require fork method from child_process // to spawn child process const fork = require('child_process').fork; // Child process file const child_file = 'child.js'; // Spawn child process const child = fork(child_file); Filename: child.js JavaScript console.log('In child.js') if (process.connected) { console.log("Child Process connected!") console.log("Disconnecting in 3000ms") setTimeout(() => { process.disconnect(); }, 3000); } process.on('disconnect', () => { console.log("Child Process disconnected!") }); Output: In child.js Child Process connected! Disconnecting in 3000ms Child Process disconnected! Example 2: Filename: parent.js JavaScript // Require fork method from child_process // to spawn child process const fork = require('child_process').fork; // Child process file const child_file = 'child2.js'; // Spawn child process const child = fork(child_file); Filename: child2.js JavaScript console.log("In Child Process!") process.disconnect() process.on('disconnect', () => { console.log(`Child process disconnected`); }); Output: In Child Process! Child process disconnected Reference: https://nodejs.org/api/process.html#event-disconnect Comment More infoAdvertise with us Next Article Node.js Process disconnect Event A aritrikghosh784 Follow Improve Article Tags : Technical Scripter Web Technologies Node.js Technical Scripter 2022 Node.js-events-module +1 More Similar Reads Node.js process.disconnect() Method The process.disconnect() property is an inbuilt application programming interface of the process module which is used by the child process to disconnect from the parent process. This method does not work for the root process because it does not have any parent process. Syntax: process.disconnect()Pa 2 min read Node.js Process beforeExit Event The 'beforeExit' is an event of class Process within the process module which is emitted when Node.js empties its event loop and has no additional work to schedule. Syntax: Event: 'beforeExit'Parameters: This event does not accept any argument as the parameter. Return Value: This event returns nothi 2 min read Node.js process.connected Property The process.connected property is an inbuilt property of the process module which is used by the child process to check if it is connected to the parent process or not. Syntax: process.connectedReturn Value: If the process was spawned from another process then the process.connected property will re 2 min read Node.js Process exit Event The process is the global object in Node.js that keeps track of and contains all the information of the particular node.js process that is executing at a particular time on the machine. The process.exit() method is the method that is used to end the Node.js process. Every process action on the mach 2 min read Node.js Process Signal Events Signals are a POSIX (The Portable Operating System Interface) intercommunication system. These events will be emitted when Node receives signal events. In order to notify that an event has occurred, a notification is sent. The signal handler will receive the signal's name and the signal name is uppe 3 min read Like