python-hyper / hyper

HTTP/2 for Python.
http://hyper.rtfd.org/en/latest/
MIT License
1.05k stars 192 forks source link

Send ping frame #274

Closed maxpowel closed 8 years ago

maxpowel commented 8 years ago

Hi, I have a long time connections and sometimes they can be in idle state for a long time (ej 15 minutes). If I can send a PING frame I would know if the connection is still up. I saw that the h2.connection has the method ping but probably is not that simple using it in hyper connection. Catch the ConnectionTerminated event would be nice too, even better at least for me.

Now what I'm doing is catch HTTP20Error exception and reconnect, but the problem is that I don't really know what happened. The best I think that is to know if the connection went down because of the server (it closed the connection peacefully and reconnect is nice) or network problem (data corrupted or something like that because when network is down a socket error is raised).

An alternative (or the correct) way to do this would also be appreciated.

Thank you

Lukasa commented 8 years ago

Hey!

We'll merge #273 shortly, which should help with this!

maxpowel commented 8 years ago

Thank you!