undici icon indicating copy to clipboard operation
undici copied to clipboard

Expose HTTP/2 ping

Open AndrewBarba opened this issue 7 months ago • 2 comments

This would solve...

Some http2 servers expect to receive PING frame during long periods of inactivity. For example, Apple's APNS service requires sending a PING in order to keep a connection alive. Note: keep alive is not enough.

The implementation should look like...

Both Pool and Client should expose a ping() method which calls the underlying Http2Session.ping() method.

Real-world issue

https://github.com/AndrewBarba/apns2/issues/97

Real-world work around

https://github.com/AndrewBarba/apns2/pull/98

AndrewBarba avatar May 19 '25 18:05 AndrewBarba

I think for HTTP/2 connections we could send a ping() at a given interval instead. Would that work for you? In case, would you like to send a PR?

mcollina avatar May 20 '25 07:05 mcollina

@mcollina yes an interval option would be perfect. I'll take a look at implementing

AndrewBarba avatar May 20 '25 11:05 AndrewBarba