O'Reilly logo

Building Scalable Apps with Redis and Node.js by Joshua Johanan

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Finishing Socket.IO

We have built many little Socket.IO demonstration applications, and now is the time to create the Socket.IO we are going to use. We only need to update the authorization and connection functions. Let's get started. Open up index.js present in the socket.io folder and make the following changes to the require statements at the top:

var io = require('socket.io'), cookie = require('cookie'), cookieParser = require('cookie-parser'), expressSession = require('express-session'), ConnectRedis = require('connect-redis')(expressSession), redisAdapter = require('socket.io-redis'), redis = require('redis'), config = require('../config'), redisSession = new ConnectRedis({host: config.redisHost, port: config.redisPort}), redisChat = require('../redis/chat'), ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required