[Solved] Order and filter Server-Sent-Events in angular.js eventsource

vak Asks: Order and filter Server-Sent-Events in angular.js eventsource
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) {
}, 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,

Ten-tools.com may not be responsible for the answers or solutions given to any question asked by the users. All Answers or responses are user generated answers and we do not have proof of its validity or correctness. Please vote for the answer that helped you in order to help others find out which is the most helpful answer. Questions labeled as solved may be solved or may not be solved depending on the type of question and the date posted for some posts may be scheduled to be deleted periodically. Do not hesitate to share your response here to help other visitors like you. Thank you, Ten-tools.