From 604453c8ec899ab1101a16430ee2609099b4333a Mon Sep 17 00:00:00 2001 From: James M Snell Date: Fri, 21 Sep 2018 14:14:04 -0700 Subject: [PATCH 1/2] http2: add ping event Add a `Http2Session` event whenever a non-ack `PING` is received. Fixes: https://github.com/nodejs/node/issues/18514 --- doc/api/http2.md | 10 +++++++ lib/internal/http2/core.js | 10 +++++++ src/env.h | 1 + src/node_http2.cc | 17 +++++++---- test/parallel/test-http2-onping.js | 48 ++++++++++++++++++++++++++++++ 5 files changed, 81 insertions(+), 5 deletions(-) create mode 100644 test/parallel/test-http2-onping.js diff --git a/doc/api/http2.md b/doc/api/http2.md index 205c0dc85b8102..698f1bf2d87e58 100644 --- a/doc/api/http2.md +++ b/doc/api/http2.md @@ -222,6 +222,16 @@ session.on('localSettings', (settings) => { }); ``` +#### Event: 'ping' + + +* `payload` {Buffer} The `PING` frame 8-byte payload + +The `'ping'` event is emitted whenever a `PING` frame is received from the +connected peer. + #### Event: 'remoteSettings'