The final thing we are going to add is to switch Socket.IO's internal communication about room participation. By default, Socket.IO will not let other Socket.IO nodes know about room changes. As we know now, we cannot have an application state that is stored only on one server. We need to store it in Redis. Therefore, we add it to
index.js, present in
packtchat\socket.io. Add the following code to the variable declarations:
Var redisAdapter = require('socket.io-redis');
An application state is a flexible idea. We can store the application state locally. This is done when the state does not need to be shared. A simple example is keeping the path to a local temp file. When the data will be needed by multiple ...