title: Socket.io with redis store emits events in the callback function consume of AMQP
body: <p>I want to use <code>nodejs</code> server to receive messages from <code>AMQP</code>, then push those messages to web page through <code>socket.io</code> with <code>redis</code>.</p>
  
  <p>The <code>emit()</code> function is invoked in the callback function <code>consume</code> of AMQP, and web UI can get those data. However, I can NOT find any data in <code>redis</code>?</p>
  
  <p>codes</p>
  
  <pre><code>var redisPort = 6379,
      redisHost = 'localhost';
  
  var app = require('express')(),
      http = require('http').Server(app),
      io = require('socket.io')(http),
      redisAdapter = require('socket.io-redis'),
      redis = require('redis');
  
  var
      pub = redis.createClient(redisPort, redisHost),
      sub = redis.createClient(redisPort, redisHost, {detect_buffers: true});
  
  //
  io.adapter( redisAdapter({pubClient: pub, subClient: sub}) );
  
  app.get('/', function(req, res){
  
      res.sendFile('index.html');
  });
  
  io.on('connection', function(socket){
      console.log("web socket connection ...");
  
      socket.join('room');
  
      socket.on('disconnect', function(){
          console.log("socketio diconnect...");
      });
  });
  </code></pre>
  
  <p>call back function in <code>AMQP</code></p>
  
  <pre><code>function response(msg){
      io.to('room').emit('online', msg);
  }
  
  ...
  
  ch.consume(queue, response, {noAck: true});
  </code></pre>
  
  <p>Am I right to use this API <code>emit()</code>? or miss any good trick?</p>