title: socket.io client not receiving message
body: <p>When no room is specified client receive the message but when specify a room I am unable to receive message on client.</p>
  
  <p>server.js</p>
  
  <pre><code>var socket = require('socket.io');
  var mysql = require('mysql');
  const path = require('path');
  var express = require('express');
  var app = express();
  var server = require('http').createServer(app);
  var io = socket.listen(server);
  var port = PORT;
  io.on('connection', (socket) =&gt; {
  
    console.log('new connection made');
  
    socket.on('subscribe', function (room) {
      socket.room = room;
      socket.join(socket.room, function () {
        console.log('joined:' + room); // outputs joined: 1
        socket.on('send-message', (data) =&gt; {
              io.to(data.room).emit('message-received', data.message);
              console.log("sent to room:" + data.room);  // outputs sent to room: 1
  
        });
      });
    });
  });
  
  server.listen(port, function () {
    console.log('Server listening at port %d', port);
  });
  </code></pre>
  
  <p>client.js</p>
  
  <pre><code>this.socket = io.connect('ws://IP:PORT');
  
  this.socket.on('connect', () =&gt; {
    console.log("connection made"); // it output connection made in console
    this.socket.emit('subscribe', 1);
  });
  this.socket.on('message-received', (message: any) =&gt; {
     console.log(message);
  });
  </code></pre>
  
  <p>on server.js I have tried several options below but still unable to emit 'message-received' on client side:</p>
  
  <pre><code>// io.emit('message-received', data);
  // io.to(data.room).emit('message-received', {
    //   room: data.room,
    //   message: data.message
  // });
  // io.sockets.in(data.room).emit('message-received', {
  //   room: data.room,
  //   message: data.message
  // });
  //io.broadcast.to(data.room).emit('message-received', data.message);
  </code></pre>
  
  <p>using latest socket.io library with angular 4</p>