1

I'm trying to popup a message when the sse connection of the EventSource get closed from backend. I tried with eventsource.onerror and checked for state CLOSED of EventSource.readyState as well. But non of them get triggered.

Is there any way to identify the sse connection get closed?

Choxmi
  • 1,584
  • 4
  • 29
  • 47
  • 1
    Does this answer your question? [How to close a "Server-Sent Events"-connection on the server?](https://stackoverflow.com/questions/6534572/how-to-close-a-server-sent-events-connection-on-the-server) – andykais Jul 11 '20 at 20:36
  • @andykais it's valid solution for nodejs. I was using C backend and couldn't find a proper way to achieve this. Thanks for the suggestion – Choxmi Jul 12 '20 at 06:51
  • No prob. By the way you can definitely implement something similar in C if you wanted. The only special part about what I suggested was setting up a protocol on top of SSE. You can do that in any language. Totally fine to leave your question open here, maybe someone has a C specific solution. If you find something that works yourself you can post that too! – andykais Jul 12 '20 at 06:55

0 Answers0