title: Is it possible to limit socket.io to have only one listener per event?
body: <p>my question is if its possible to limit the bind listener possibility for specific event? For example I have a listener:</p>
  
  <pre><code>//In server
  socket.emit('something', { message: 'Hello World!' });
  
  //At client
  socket.on('something', (data) =&gt; {
      console.log(data.message);  
  });
  
  //Output in console
  Hello World!
  </code></pre>
  
  <p>But if I duplicate that snippet somewhere else in the code, I bind 2 same listeners to one event, so I get 2 console logs where I wanted only one.</p>
  
  <pre><code>//In server
  socket.emit('something', { message: 'Hello World!' });
  
  //At client
  socket.on('something', (data) =&gt; {
      console.log(data.message);  
  });
  
  socket.on('something', (data) =&gt; {
      console.log(data.message);  
  });
  
  //Output in console
  Hello World!
  Hello World!
  </code></pre>
  
  <p>I know that there is possible to have multiple listeners for different actions on single event but when I use socket.io in some frameworks and switch between components (where I have binding in constructor of the component) the framework just binds the same listener to same event every time that i switch between components. So the result is like above.</p>
  
  <p>So my question is:</p>
  
  <ul>
  <li>Is it possible to check if some event already has listener and ignore second bind?</li>
  <li>Or if it's there is some socket.io configuration setting that would allow to bind only one listener per event and when you bind a new one that it would override the old one? </li>
  <li>Or just some good practices on how to handle such situation?</li>
  </ul>