void OnQuery(JsonObject result)
    {
        if (Convert.ToInt32(result["code"]) == 200)
        {
            wpClient.disconnect();

            string host = (string)result["host"];
            int    port = Convert.ToInt32(result["port"]);

            wpClient = new WebglPomeloClient();
            wpClient.initClient("ws://" + host + ":" + port.ToString() + "/", () =>
            {
                JsonObject msg = new JsonObject();
                wpClient.connect(msg, (JsonObject json) =>
                {
                    JsonObject userMessage  = new JsonObject();
                    userMessage["username"] = userName;
                    userMessage["rid"]      = channel;
                    if (wpClient != null)
                    {
                        wpClient.request("connector.entryHandler.enter", userMessage, OnEntry);
                    }
                });
            });
        }
    }
    public void Login()
    {
        userName = inputName.text;
        channel  = inputChannel.text;
        if (wpClient == null)
        {
            wpClient = new WebglPomeloClient();
            //监听网络状态变化事件
            wpClient.NetWorkStateChangedEvent += (state) =>
            {
                Debug.Log("CurrentState is:" + state);
            };

            wpClient.initClient("ws://127.0.0.1:3014/", () =>
            {
                JsonObject msg = new JsonObject();
                wpClient.connect(msg, (JsonObject json) =>
                {
                    JsonObject user = new JsonObject();
                    user["uid"]     = userName;
                    wpClient.request("gate.gateHandler.queryEntry", user, OnQuery);
                });
            });
        }
    }