Synchronizing and scaling websocket feeds
Earlier in this book, we explored websockets in the Websockets for two-way communication section of Chapter 5, Building Response Handlers. If you have not read that section yet, I encourage you to do that now. At this time, we are going to take our websocket implementation and create a horizontally scalable websocket feed. The basic premise of the code here will be the same as in that section, which is why you should have an understanding of what we build there before moving on to the example here.
The purpose of the feed we will build is to share events that happen in one browser across to another browser. Building upon the example from Chapter 5, Building Response Handlers, we are going to add a third-party broker that will allow us to run multiple application instances. This means that we can horizontally scale our application. The previous implementation suffered from the fact that it stored client information in memory. With no mechanism...