[Libwebsockets] Identify SSE connection close from frontend

Andy Green andy at warmcat.com
Thu Apr 18 13:25:16 CEST 2019



On 18/04/2019 19:18, Choxmi Sathsara wrote:
> Hi,
> 
> 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.

Where are you return 1 from, ie, which callback?

> 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.

Is there a convenient way I can reproduce it, eg, using a modified SSE 
minamal example?

-Andy

> Thanks and regards,
> Choxmi
> _______________________________________________
> Libwebsockets mailing list
> Libwebsockets at ml.libwebsockets.org
> https://libwebsockets.org/mailman/listinfo/libwebsockets
> 


More information about the Libwebsockets mailing list