I am designing a web server that handles multiple things such as a user-to-user chat, a user-to-group chat, friends request, forum etc.
The chats have to be real-time chats, the friends requests should be notified in real-time to the user, and the users should be instantly notified about the new topics on the forum.
I use Spring and I implemented long polling to lower the latency and the number of requests. In theory long polling works well for one thing (a chat for example).
The problem here is that the client has to be notified for multiple reasons: new message on chat, new message on forum, new friend request etc. The naive solution would be to use long polling requests for each action, but it leads to having all the clients opening four or five requests at the same time.
Can the server easily handle this or should I manage to create a system so that every notification is returned through only one request? Is there another solution?