rewrite WebSocket as socket wrapping duplex stream

See #45 for more information.