refactor failed
settimeout when web socket is not ready.