Better event loop in WebSocketApp

Handle ping/pong events in WebSocketApp event loop.
Ensure one time WebSocket connection closing.