/// <summary>
 /// connect to server and response
 /// </summary>
 /// <param name="ip"></param>
 /// <param name="port"></param>
 /// <param name="user">handshake msg for connect</param>
 /// <param name="action">default request callback</param>
 public void Connect(string ip, int port, JsonObject user, Action <JsonObject> action)
 {
     if (m_Conn != null)
     {
         Debug.Log("the network has been connected!");
         return;
     }
     Debug.Log("connect to ip: " + ip + " port: " + port);
     m_Conn = new PomeloClient();
     m_Conn.NetWorkStateChangedEvent += (state) =>
     {
         Debug.Log("network state: " + state);
         if (NetState != null)
         {
             NetState.Invoke(state);
         }
     };
     m_Conn.initClient(ip, port, () =>
     {
         m_Conn.connect(user, (rt) =>
         {
             Dispatcher.Current.BeginInvoke(() =>
             {
                 action.Invoke(rt);
             });
         });
     });
 }