
Product
Introducing Tier 1 Reachability: Precision CVE Triage for Enterprise Teams
Socket’s new Tier 1 Reachability filters out up to 80% of irrelevant CVEs, so security teams can focus on the vulnerabilities that matter.
ipc-emitter
Advanced tools
npm install --save ipc-emitter
const {master} = require('ipc-emitter')
Master is an EventEmitter, with a few differences.
When it emits an event (using the .emit() function) apart from triggering its own listeners, it also notifies other acknowledged processes (i.e. Worker
s) through the IPC Channel (using process.send() method).
In addition to this, it also listens for events emitted by acknowledged processes (by listening for their message
event) so that it triggers its own listeners and also notifies other acknowledged processes to trigger their own (note that the process which triggered the event is not notified).
When getting a Master IPC-Emitter it will always return a new object.
Acknowledges a process (Worker
). Doing so the Master:
Removes a process (Worker
) from the list of acknowledged processes. Doing so the Master:
Configures the Master
to:
Configures the Master
to stop echoing events.
Configures the Master
to echo events retrieved by its Worker
s, to its own Master
.
When a
Master
is configured to echo events to its ownWorker
s, if itself is not aWorker
a warning is issued.
Configures the Master
to stop echoing events retrieved by its Worker
s, to its own Master
.
Configures the Master
to echo events retrieved by its own Master
, to its Worker
s.
When a
Master
is configured to echo events from its ownMaster
, if itself is not aWorker
a warning is issued. When aMaster
is configured to echo events from its ownMaster
, when it recieves an event from theMaster
, its listeners won't be triggered (this is the work of theWorker
).
Configures the Master
to stop echoing events retrieved by its own Master
, to its Worker
s.
const {worker} = require('ipc-emitter')
Worker is an EventEmitter, with a few differences.
When it emits an event (using the .emit() function) apart from triggering its own listeners, it also notifies its master process through the IPC Channel (using process.send() method). Doing this if the Master Process is using the Master IPC-Emitter, the event will be echoed to all of the acknowledged workers.
When getting a Worker IPC-Emitter will always return the same object.
'use strict'
const {fork} = require('child_process')
const {master} = require('ipc-emitter')
master.on('new-user', (userId) => {
console.info(`boot: new user: ${userId}`)
})
master.ack(fork('./auth'), fork('./log'))
'use strict'
const {worker} = require('ipc-emitter')
console.info('Logger initiated')
worker.on('new-user', (userId) => {
console.info(`log: new user: ${userId}`)
})
'use strict'
const {worker} = require('ipc-emitter')
console.info('Auth initiated')
setTimeout(() => {
worker.emit('new-user', 1)
}, 2000)
Logger initiated
Auth initiated
boot: new user: 1
log: new user: 1
FAQs
EventEmitter for IPC connected node apps.
We found that ipc-emitter demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket’s new Tier 1 Reachability filters out up to 80% of irrelevant CVEs, so security teams can focus on the vulnerabilities that matter.
Research
/Security News
Ongoing npm supply chain attack spreads to DuckDB: multiple packages compromised with the same wallet-drainer malware.
Security News
The MCP Steering Committee has launched the official MCP Registry in preview, a central hub for discovering and publishing MCP servers.