title: Nodejs discover other instances of Nodejs
body: <p>A Nodejs process can easily spawn and communicate with child nodejs processes during its runtime. But is there any way for a Nodejs process to become aware of and communicate with other, <em>non-child</em>  Nodejs processes, that were spawned by some other source?</p>
  
  <p>I would imagine a solution for <em>detecting</em> other instances could involve running the <code>ps</code> command and filtering the results:</p>
  
  <pre><code>let proc = require('child_process').spawn('ps', [], {
    cwd: __dirname,
    env: process.env
  });
  
  (async () =&gt; {
    let chunks = [];
    proc.on('data', chunk =&gt; chunks.push(chunk.toString('utf8')));
    await new Promise(r =&gt; proc.on('exit', r));
    let results = chunks.join('');
  
    // TODO: Now process the String `results`, searching for lines
    // which seem to describe a Nodejs process. Capture the pids of
    // these lines
  })();
  </code></pre>
  
  <p>Communicating with the pids discovered in this way would likely be a whole other process.</p>
  
  <p><strong>Can this problem be solved? Is there an existing library that does this? Can this be done in a cross-platform way?</strong></p>