nopoll icon indicating copy to clipboard operation
nopoll copied to clipboard

Add ping handler support for ping frame.

Open mrigaya opened this issue 6 years ago • 3 comments

As per https://tools.ietf.org/html/rfc6455#section-5.5.2 definition, A Ping frame MAY include "Application data".

In nopoll when PING frame is recieved with payload, it responds with PONG frame having same payload. In case if the user/client is interested in the payload/application data it received with PING, then there is no option for the client to get that payload.

If we have ping handler similar to msg handler then it will be useful/easier for the client to get that payload. And based on the ping handler, client can set the timer in their application to detect any timeout or pings not received over the connection for certain amount of time due to some network issue, then client can close the connection completely and retry again with new server.

Review these changes and Please let me know if it requires any modification/suggestion from your end.

mrigaya avatar Mar 06 '18 09:03 mrigaya

It would be useful also to call conn->on_ping_msg before sending the pong when there is no payload, in case the application just needs to know that a ping was received, but there is no need for data. Around line 3458.

softins avatar Mar 06 '18 10:03 softins

Dear @mrigaya Thanks for your time and the patch. The idea looks good to me. @softins's idea too. I'll review all this asap. Best Regards.

francisbrosnan avatar Mar 06 '18 11:03 francisbrosnan

@francisbrosnan Any suggestion on this pull request?

mrigaya avatar Jun 08 '18 08:06 mrigaya