Add websocket termination support and fix validation bug