spdy-http2 / node-spdy

SPDY server on Node.js
2.81k stars 196 forks source link

Add a success event to _handlePing to allow taking an action when a successful ping comes in. #193

Closed jeffreydwalter closed 8 years ago

jeffreydwalter commented 9 years ago

I have a need to track, and take action, when a spdy ping is received from my spdy client. In the client/server I'm building, we're tunneling spdy over persistent tls connections and we're using ping to track network connectivity loss in the event of unclean socket closure (switch networks, close laptop, etc.)

Something like this: https://gist.github.com/jeffreydwalter/c4c540f6085a7e69c720

Is there currently a way to do what I'm after? If no, what do you think about this suggestion?

jeffreydwalter commented 9 years ago

@indutny any thoughts on this? Does my question/request make sense?

indutny commented 9 years ago

Sorry for not replying in time, @jeffreydwalter ! Sure this makes total sense. I have a suggestion though, what if the event will be named just ping and will have id as a first and the only argument? Also is there any point in emitting it after sending the reply? There is no guarantee that it was handled by other side, and thus probably no point in postponing the event until then.

Anyway, would you be interested in contributing this feature to node-spdy? ;)

jeffreydwalter commented 9 years ago

I'm okay with naming it ping and including the id. I don't guess it matters whether we raise the event before or after the call to write(). I'll go ahead and make a pull request.

indutny commented 9 years ago

Thanks man!