title: NodeJS: One Global EventEmitter or every module it's own?
body: <p>I am currently planning to create a browsergame in NodeJS. The Game will use events for basicly every communication between the modules.</p>
  
  <h2>What is more performant (or has advantages or disadvantages?):</h2>
  
  <p>I use only one (global?) EventEmitter. Every module can listen to that global event stream or emit events in the global event stream. I would use more complex event-names, so when an event is fired, not all listeners on the global event stream are called. I have a really high amount of listeners on one single event stream.</p>
  
  <p>Example: Player1 receives an item. The event "player1:inventory:item" is fired, and only player1 listens on that event on the global event stream.</p>
  
  <h2>OR</h2>
  
  <p>Every module on it's own extends the events.EventEmitter and provides only the events for that specific object. The number of listeners on every EventEmitter is very low, most of the time there is only one listener.</p>
  
  <p>Example: A single player has a questlog and an inventory. For every player I create an instance of questlog and inventory, hold them in a collection (or the player object). The questlog of player1 ONLY listens on the inventory of player1.</p>
  
  <hr>
  
  <p>I don't have experience with the EventEmitter in NodeJS and only know that there is a warning when there are more that 10 listeners on one eventemitter or event because of memory leaks, but I don't know why.</p>
  
  <p>I see some advantages and disadvantages on both systems, but on the technical side I need advice.</p>
  
  <p>Thanks for every help!</p>