Added validation and webSocket close