Today I've searched a couple of hours for an implementation or tutorial in how to keep track of websocket connections in Spring. 

I've done the (very good) Spring tutorial about websockets and STOMP. 
link [here](https://spring.io/guides/gs/messaging-stomp-websocket/)

So what's my setup, I have an Ionic Hybrid app with an Spring backend and I want to send a notification to the client whenever a new notification-event arises in the backend. All this code is already implemented and the connection works, but right now there is no way to specify where the notifications need to go to.

There is no tutorial or explanation on this matter that follows the structure in the Spring tutorial (at least not after 5 hours of research) and I am a little overwhelmed by all the information about websockets and security on the web. (I've been learning about websockets for just 2 days)

So for all that been before me and will come after me, I think it can be very usefull to have a compact and lightweight answer following the structure taught by the Spring Tutorial.

I've found [this unanswered question](https://stackoverflow.com/questions/37854062/authentication-model-for-spring-websocket-sockjs-and-sending-messages-on-per-u) on StackOverflow about the same problems as I have, so I'm sure this questions will prove it's worth.

TL;DR

How to implement a list in the backend that keeps track of the connections based on the [Spring WebSocket Tutorial](https://spring.io/guides/gs/messaging-stomp-websocket/)?

How to send data from the client to the backend when the connection is established? (for example a userid or token)