Currently our implementation cannot be used if we decide to deploy several servers. Imagine the scenario where user A connects to server A, and user B connects to server B; user A and user B cannot chat, because they are on different servers.
To make users connected from different servers communicate, we need to find a way to make our server communicate, and we can do this using the Redis database. Among other amazing features, Redis supports what is called a publish/subscriber pattern. With this pattern, a server can publish a message, and all servers subscribed to listen to that message will receive it.
With this feature Redis is the perfect database to solve our problem of server communication, so let's see how we can connect to it to receive messages and also how we can change our data store to support it.