phoenixframework/phoenix — pull request #449 by nickmeharry (2014-10-31 20:15:44+00:00)
Title: Add :ping and :pong to Phoenix.Socket.Handler.websocket_handle/3

The `cowboy_websocket` module takes care of sending the reply to WebSocket ping frames, but then immediately crashes the process by invoking `websocket_handle`. This change just adds no-op clauses appropriately.

Some browsers (such as IE 11) send unsolicited pong frames to keep the underlying TCP connection alive. This is allowed per [RFC 6455 § 5.5.3](https://tools.ietf.org/html/rfc6455#section-5.5.3). This causes the handler process to crash and the connection proceeds to time out.

For future reference, Cowboy also provides a `:binary` tag, which I left unhandled.