Unable to run minimal socket.io server

I just installed NodeJS, Socket.IO and all its dependencies. Then trying to execute code below as per Socket.IO docs

var app = require('express')();
var http = require('http').Server(app);

var io = require('socket.io-emitter')(http);

var redis = require('socket.io-redis');

io.adapter(redis({
    host: 'localhost',
    port: 6379
}));

server.listen(80);

app.get('/', function (req, res) {
    res.sendfile(__dirname + '/index.html');
});

io.on('connection', function (socket) {
    socket.emit('news', {
        hello: 'world'
    });
    socket.on('my other event', function (data) {
        console.log(data);
    });
});

But it failed with error if (!opts.socket && !opts.host) throw new Error('Missing redis host');

The line that's throwing is this one, I suspect:

var io = require('socket.io-emitter')(http);

The Emitter constructor expects either a redis client or options for creating a redis client (either socket or host and port). It is throwing because you're passing an object (http) that neither looks like a redis client nor has options for creating a client.