[Libwebsockets] TR: Web socket server received a ping

Andy Green andy at warmcat.com
Tue Oct 13 10:18:01 CEST 2020



On 10/13/20 8:51 AM, Peiffer Eric wrote:
> Hi ,
> 
> I resend my question 

You sent it originally to "libwebsockets-bounces"

> is it a way to have an event when the web socket 
> server receive a web socket ping?

No, because in RFC6455 ws PING is defined to do one thing, return a PONG 
with the exact same payload as the PING came in with.  Lws takes care of 
that for you.

There's a callback LWS_CALLBACK_RECEIVE_PONG to indicate the PONG 
arrived though.

In v4.1+ the connection validity stuff takes care of the larger issue of 
confirming that the connection is still passing data both ways, and 
generates PINGs and times out PONGs for you.

https://libwebsockets.org/git/libwebsockets/tree/READMEs/README.lws_retry.md

-Andy

> Regards,
> 
> Eric
> 
> ------------------------------------------------------------------------
> *De :* Peiffer Eric
> *Envoyé :* lundi 12 octobre 2020 14:27
> *À :* Libwebsockets <libwebsockets-bounces at ml.libwebsockets.org>
> *Objet :* Web socket server received a ping
> Hi,
> 
> Is there a callback, when the web socket server receives a web socket 
> ping from the client?
> 
> Regards,
> 
> Eric.
> 
> _______________________________________________
> Libwebsockets mailing list
> Libwebsockets at ml.libwebsockets.org
> https://libwebsockets.org/mailman/listinfo/libwebsockets
> 


More information about the Libwebsockets mailing list