add pingpong and better reconnect