[Libwebsockets] Identify SSE connection close from frontend

Choxmi Sathsara choxmi at paraqum.com
Thu Apr 18 13:18:03 CEST 2019


I'm using LWS SSE to broadcast data. Since there is a limitation of number of SSE connections for a browser, I need to close SSE connections on number of SSE connections exceed the limit.

Even though I close the connection by returning 1, the frontend connection remains. I tried with `eventsource.onerror` and `CLOSED` state of `eventsource.readystate`. But non of them get triggered.

But when I terminate the backend process, `onerror` get triggered. What am I doing wrong? Is there any way to terminate the connection?

Any help would be much appreciated.

Thanks and regards,

More information about the Libwebsockets mailing list