joedevivo / chatterbox

HTTP/2 Server for Erlang. Boy, that guy was a real chatterbox waddn't he? I didn't think he was ever going to stop with the story.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How do I send PING using h2_client?

arkadiyk opened this issue · comments

My firewall kills connection after 30 min idle time..

Looks like h2_connection has a send_frame/2 function. A ping frame can be represented with <<0, 0, 8, 6, 0, 0, 0, 0, 0>>.

In Elixir I think it would be as simple as :h2_connection.send_frame(pid, <<0, 0, 8, 6, 0, 0, 0, 0, 0>>)

I'm having difficulty getting any sort of ping ACK though, so no clue if it's actually working.

There's a more elegant solution, but this reply is just to help unblock whatever you're working on.

PING frames require a payload. You're just sending the frame header. The PING frame needs an 8 byte payload, which the ACK will send back for you to confirm. https://http2.github.io/http2-spec/#PING

This PR adds ping API: #107

Closing since the PR was merged.