added condition when to uses WS connection