Added automatic handling of PING events according to RFC 6455
Handle all PINGs automatically.
Pros: according to RFC that will include the content in the PONG.
Cons: no control over the PINGs in case you want to add some logic when a ping arrives.
In response to: https://github.com/fanout/django-grip/issues/21
So I am not really sure what the desired functionality would be.
Either it is invisible to the user, but for example in my use case I would be interested when the last ping arrived or a larger change in the API is needed so that it is possible to handle the pings manually.
This for bringing this up earlier. I made a fix in 5706cb6893bafe5929c9b290571d717b3df97ea3. Pings are still handled as the app processes messages, to ensure each event is handled in-order, however now any pings prior to the next message are handled when can_recv() is called. This should cover cases where a request contains only pings, or contains recv()-able messages followed by only pings. Also, the content is echoed in the pong.
If custom ping handling is needed, I'm open to adding a more low level API that maybe reads/writes WebSocketEvent objects. However, if all you need to do is inspect pings maybe checking in in_events is good enough.