title: Use socketIO.emit in external controller client side
body: <p>I have the following problem. I want to separate all socket.emit functions from the client into a separate controller class so I can call the Controller functions and receive the response:</p>
  
  <p>app/components/client.js</p>
  
  <pre><code>let response = NodeController.root(path);
  console.log('response', response);
  if(response){
      var projectInfoId = JSON.parse(response);
  }
  </code></pre>
  
  <p>app/controller/node-controller.js</p>
  
  <pre><code>class NodeController {
      static root(data){
          let tmp;
          socket.emit('/', data, function (response) {
              tmp = response;
          });
          return tmp;
      }
  }
  </code></pre>
  
  <p>The projectInfoId in client.js will be undefined because the response is undefined. If i call socket.emit() directly in the client with the callback function, I will receive the data und my projectInfoId will contain something.</p>
  
  <p>Is it possblie to sepearte the socket functions from the client.js code or do I have to call it directly in the client.js file? </p>