[Libwebsockets] close: cause and TCP information

Andy Green andy at warmcat.com
Tue Jan 14 11:29:51 CET 2020



On 1/14/20 10:21 AM, Peiffer Eric wrote:
> Hi,
> I'm writing a web socket server based on libwebsocket.
> When a client closes the web socket we have the event
> 
> LWS_CALLBACK_WS_PEER_INITIATED_CLOSE
> 
> But when the peer stop in an abnormal way, on the server side we do not 
> have any event that indicate the cause. Same problem for a network 
> issue. How can I retreive the TCP status when the web socket server 
> receive a LWS_CALLBACK_CLOSED

What does "tcp status" mean to you?  In the usual case it's over tls, 
the problem that caused the close can have happened at tls layer, ws 
framing layer, ws compression layer, "user code" / protocol layer... in 
the case of ws-over-h2 / rfc8441, the lifecycle of the stream is 
unrelated to the lifecycle of the tcp connection since many stream may 
mux over a single tcp connection.  None of those necessarily really 
resolve to some "tcp status" to explain what happened.

You're trying to produce metrics for what happened, or something else?

-Andy

> Regards,
> 
> Eric Peiffer
> 
> 
> _______________________________________________
> Libwebsockets mailing list
> Libwebsockets at ml.libwebsockets.org
> https://libwebsockets.org/mailman/listinfo/libwebsockets
> 


More information about the Libwebsockets mailing list