I have a Client in AngularJS where I consume multiple SSE (Server-Sent-Events) in Java from the Server Side (there are multiple endpoints in different web servers in the backend). Diagram link
I currently register a listener to each type of event coming from each SSE connection, such as:
source.addEventListener('alpha', function(e) {
doSomething();
}, false);
The purpose is to show a notification based on these events, and with this I have a few questions:
- How can the client know if the information has changed in the backend?
- How to organise and filter these events? For example, by receiving simultaneously multiple events from multiple connections, how can I manage them in order to show the client an specific notification regarding an specific event?
Note: I'm not only talking only about organising an event per type, but I also need to have in mind if an event is more important than another.
So far I only think of receiving all the events, and save them in a list that I could order and filter. Is there a problem if two SSE events are fired at the same time? Do you know of an example of this?
- Is it a good idea to make the logic for organising the events on the client side?
- Should I create a database for these events?
Thank you,