title: Socket.io MVC node.js emit to room
body: <p>I have been looking into this <a href="https://github.com/misirlu13/Socket.MVC" rel="nofollow noreferrer">Socket.io MVC node.js</a> but I'm currently struggling. </p>
  
  <p>It says in the documentation:</p>
  
  <blockquote>
    <p>Socket.io API's</p>
    
    <p>Since Socket.MVC is just a wrapping mechanism for Socket.io, all of
    the same API's can be used using the Socket.MVC module. Please see a
    list of all of the API's available by visiting the Socket.io Github
    page, or <a href="http://socket.io" rel="nofollow noreferrer">http://socket.io</a> (depending on your version)</p>
  </blockquote>
  
  <p>My problem is that I cant find a way to emit socket MVC to a room.</p>
  
  <pre><code>socketMVC.to(userid).emit('message', {message:2});
  </code></pre>
  
  <p>Should work, but it doesn't. Any idea how I can accomplish this?</p>
  
  <p>EDIT:
  userid is same as assigned here:
  import  * as io from 'socket.io-client';</p>
  
  <p>download</p>
  
  <pre><code>oninit:
        this.socket = io(this.socketurl);
  
  
        var privateRoom = socket.request.session.passport.user;
  
          socket.join(privateRoom);
  
  
        this.socket.on('message', (data) =&gt; {
              //  this.messagesCounter = this.messagesCounter + 1;
                alert("OMG?");
            });
  </code></pre>
  
  <p>edit , in server.js</p>
  
  <pre><code>io.on('connection',function(socket) {
      console.log('user connected');
      OnlineUsers.push(socket);
    //  socket.join('');
      console.log(socket.request.session.passport);
      console.log("user is connceted");
  
  
  
  
      socketMVC.init(io, socket, {
          debug: true,
          filePath: ['./src/routes/sockets.js']
      });
  
  
  
  socket.on('disconnect', function(){
      console.log('user disconnected');
  });
  
  socket.on('add-message',function (message) {
      io.emit('message', {type:'new-message', text: message});
  });
  
      socket.on('myevent', function(someData) {
          console.log("MYEVENT WORKS???????");
      });
  
  });
  </code></pre>
  
  <p>sockets.js</p>
  
  <pre><code>var path = require('path');
  
  
  module.exports = function (socket) {
     var privateRoom = socket.request.session.passport.user;
  
      socket.join(privateRoom);
  
  
      socket.on('testing', function() {
          console.log('GOT SOME SORT OF RESPONSE!!!');
      });
  };
  </code></pre>