Home » Javascript » multiple listener for server sent event

multiple listener for server sent event

Posted by: admin November 1, 2017 Leave a comment

Questions:

I think I misunderstood SSE a little. I created a controller that returns a ´SseEmitter´ in my Spring application.

When curling to my endpoint /get/status my curl is put on hold and waiting for emitted events. That does work fine. As I testet the same behaviour with my inline Javascript it worked, too.

As ran my webpage with the inline Javascript and after that opened a connection with curl again – it happened that I only receive the messages on one listener.

I assumed that Server Sent events kind of work like Publisher/Subscriber but that seems to be wrong? Please guide me to the right path of Server Sent Events.

Answers: