Refactor all polling code into a polling transport layer. We're ready to use web socket as the primary transport.

Websocket is always disabled at the moment, so current implementation is equivalent to previous one.
Implement web socket transport protocol.

This version uses web socket like the polling protocol. Responses are sent upon requests only.
Improve dispatcher exception handling to avoid memory leaks