If it's just a web app then you might be able to do something using webRTC. create some 'rooms' and have a signalling server just for the initial connection. Could be worth looking into SIP and the architecture around that.
I would recommend that you don't actually build this system yourself unless you have a team and intend to market the real time system as a product to sell or if it's a personal project. There are so many things that can go wrong and to consider.
As a side note, as you're building this from scratch I would consider building it in either C++ or Go-lang. Both have significant execution times over Java.
In answer to your question specifically;
For each client you basically setup a WSS to the server. This then routes based on the target and payload. Bit like how people (the messages) changes trains (wss) in a train station (server/client).