diff options
author | Loïc Hoguin <[email protected]> | 2019-09-24 19:18:35 +0200 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2019-09-24 19:28:48 +0200 |
commit | d9a970be90d0105af215531d74809878f9c21338 (patch) | |
tree | eb891e8c9373dee9f7353a9920aaf25f6b2f2570 /src/gun_http2.erl | |
parent | a18ca0ae8ff76594c7b629f4340adab0a30954c4 (diff) | |
download | gun-d9a970be90d0105af215531d74809878f9c21338.tar.gz gun-d9a970be90d0105af215531d74809878f9c21338.tar.bz2 gun-d9a970be90d0105af215531d74809878f9c21338.zip |
Add auto-ping to Websocket and a silence_pings option
The auto-ping will at regular interval send a ping frame.
The silence_pings option defaults to true. It can be set
to false when the user needs to receive ping/pong frames.
Diffstat (limited to 'src/gun_http2.erl')
-rw-r--r-- | src/gun_http2.erl | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/gun_http2.erl b/src/gun_http2.erl index 7041ad9..e6f09ea 100644 --- a/src/gun_http2.erl +++ b/src/gun_http2.erl @@ -25,7 +25,7 @@ -export([update_flow/4]). -export([closing/4]). -export([close/4]). --export([keepalive/1]). +-export([keepalive/3]). -export([headers/11]). -export([request/12]). -export([data/7]). @@ -512,9 +512,9 @@ close_stream(#stream{ref=StreamRef, reply_to=ReplyTo}, Reason) -> ReplyTo ! {gun_error, self(), StreamRef, Reason}, ok. -keepalive(State=#http2_state{socket=Socket, transport=Transport}) -> +keepalive(State=#http2_state{socket=Socket, transport=Transport}, _, EvHandlerState) -> Transport:send(Socket, cow_http2:ping(0)), - State. + {State, EvHandlerState}. headers(State=#http2_state{socket=Socket, transport=Transport, opts=Opts, http2_machine=HTTP2Machine0, streams=Streams}, |