resolved some issue and added method to read readystate of the websocket