primus/primus — pull request #323 by STRML (2014-12-10 18:51:57+00:00)
Title: Treat protocol-level pings as valid pings with `ws` transport.

`ws` fires a `ping` event when the `ping` control frame comes through, and automatically sends a `pong` back. However, this didn't update Primus' internal heartbeat timer, so clients who are pinging healthily will still be disconnected if they are not sending data. Many modern external websocket clients support protocol-level ping and automatically send frames at intervals. This is a nice pattern and it would be great to support it without requesting that users of external tools send `primus::ping::` messages, or some other bogus message to reset the counter.

This PR simply listens for the [ping event](https://github.com/einaros/ws/blob/7bdaee4c7ee82aa8a8ea19e9b5b8dcb230312964/doc/ws.md#event-ping), fires an event (but does not fire the `ping` event, which would send a `primus::pong::null` frame), and resets the heartbeat timer.