Add implementation of ClientWebSocket

A self-sufficient implementation of ClientWebSocket and friends. Enough to do client-side websocket.

I'd say it's mostly good for a first pass except for 96935b19e17819043c054173724171a423062b6d which is not what it should be. Comments and alternative hack welcome.