secure websocket v2 implementation