title: Getting id of worker from inside worker process
body: <p>Using the node.js Cluster module, it is straightforward to get the id of a worker process.</p>
  
  <p><a href="https://nodejs.org/api/cluster.html" rel="noreferrer">https://nodejs.org/api/cluster.html</a></p>
  
  <p>that would be:</p>
  
  <pre><code>cluster.on('fork', function (worker) {
      console.log('A worker', worker.id, 'was forked.');
  });
  </code></pre>
  
  <p>but how can I get the <code>id</code> of the worker from inside the worker itself? How come the cluster module doesn't give the worker an id when the cluster forks the worker?</p>
  
  <p>Do I really have to send the worker it's cluster id from the master process?</p>
  
  <p>I am looking for something akin to:</p>
  
  <p><code>process.id</code> (as opposed to process.pid)</p>
  
  <p>or </p>
  
  <pre><code>process.worker.id
  </code></pre>
  
  <p>in any case, I am having trouble figuring out what the id of the worker is from inside the worker itself.</p>