I have deployed a Java web application in Heroku. 

Now, I want to change the back-end so that it can notify connected users regarding specific events. I thought I could use server-sent events to do that and the way I thought it would work is the following:

1. When user opens up the front-end, it would establish a connection for the server-sent events.
2. When the back-end receives such a request, it would create such a connection (basically an `EventOutput`) and store it somewhere along with the user's ID (let's say in a `Map` in memory).
3. When a new event comes along, the back-end will find the user that needs to be notified, retrieve his connection according to his ID and send him the notification.

This works just fine when you have only one machine handling the requests. 

My problem starts when I want to scale up my app and introduce more machines. Then, I cannot really store these connections in memory in one machine anymore, I need to use some centralized location. But the centralized location will need to serialize/deserialize the connection, which means that it's not the same connection anymore!

How do you usually do something like that?