public void request(string route, JsonObject msg, Action <JsonObject> action) { uint id = reqId++; this.eventManager.AddCallBack(id, action); protocol.send(route, id, msg); }
/// <summary> /// 客户端请求数据,请求成功,获取服务器反馈之后,调用action /// </summary> /// <param name="route">路由</param> /// <param name="msg">携带的信息</param> /// <param name="action">回调函数</param> public void request(string route, JsonObject msg, Action <JsonObject> action) { this.eventManager.AddCallBack(reqId, action); protocol.send(route, reqId, msg); //Log.d ("request pomelo ip=", mIp, " port=", mPort); reqId++; }
public void request(string route, JsonObject msg, Action <Message> action) { this.eventManager.AddCallBack(reqId, action); protocol.send(route, reqId, msg); reqId++; }
public void request(string route, JSONNode msg, Action <JSONNode> action) { this.eventManager.AddCallBack(reqId, action); protocol.send(route, reqId, msg); reqId++; }
public void request(object user, Action <JObject> callback) { byte[] body = Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(buildMsg(user))); protocol.send(PackageType.PKG_HANDSHAKE, body); this.callback = callback; }
public void request(JsonData user, Action <JsonData> callback) { byte[] body = Encoding.UTF8.GetBytes(JsonMapper.ToJson(buildMsg(user))); protocol.send(PackageType.PKG_HANDSHAKE, body); this.callback = callback; }
public void request(JsonObject user, Action <JsonObject> callback) { byte[] body = Encoding.UTF8.GetBytes(buildMsg(user).ToString()); protocol.send(PackageType.PKG_HANDSHAKE, body); this.callback = callback; }
public void request(string route, JsonObject msg, Action <JsonObject> action) { Debug.Log("route =" + route); Debug.Log("msg =" + msg); Debug.Log("action =" + action); Debug.Log("protocol =" + protocol); this.eventManager.AddCallBack(reqId, action); protocol.send(route, reqId, msg); reqId++; }
public void request(string route, JsonObject msg, Action <bool, JsonObject> action) { if (!inited) { action(false, null); return; } this.eventManager.AddCallBack(reqId, (obj) => { action(true, obj); }); protocol.send(route, reqId, msg); reqId++; }
public void request(string route, JsonObject msg, Action <JsonObject> action) { if (protocol == null || eventManager == null) { Debug.Log("not init"); return; } this.eventManager.AddCallBack(reqId, action); protocol.send(route, reqId, msg); reqId++; }
public void request(string route, JsonObject msg, Action <JsonObject> action) { this.eventManager.AddCallBack(reqId, action); protocol.send(route, reqId, msg); if (reqId == int.MaxValue) { reqId = 1; } else { reqId++; } }
public void sendHeartBeat(object source, ElapsedEventArgs e) { TimeSpan span = DateTime.Now - lastTime; timeout = (int)span.TotalMilliseconds; if (!enabled) { return; } Debug.Log("sendHeartBeat"); //check timeout if (timeout > interval + 3000) { Debug.Log("heartbeat timeout"); if (protocol.getPomeloClient().GetNetworkState() == NetWorkState.CONNECTED) { protocol.getPomeloClient().disconnect(); } stop(); return; } //Send heart beat protocol.send(PackageType.PKG_HEARTBEAT); }
public void request(string route, JsonObject msg, Action <Message> action) { if (netWorkState != NetWorkState.CONNECTED) { _onError("Network is down, cannot send request now!"); return; } UnityEngine.Debug.Log(">>> Send: " + route + " data: " + msg.ToString()); _eventManager.AddCallback(_reqId, action); _protocol.send(route, _reqId, msg); _reqId++; if (_reqId >= uint.MaxValue) { _reqId = 100; } }
public void request(uint pid, string route, JsonObject msg, Action <Message> action) { if (netWorkState != NetWorkState.CONNECTED) { _onError("Network is down, cannot send request now!"); return; } UnityEngine.Debug.Log(">>> Send: " + route + " data: " + msg.ToString()); if (action == null) { notify(route, msg); } else { if (_eventManager.AddCallback(pid, action)) { _protocol.send(route, pid, msg); } } }
public void sendHeartBeat(object source, ElapsedEventArgs e) { //check timeout if (timeout > interval * 2) { protocol.getPomeloClient().disconnect(); } TimeSpan span = DateTime.Now - lastTime; timeout += (int)span.TotalMilliseconds; //Send heart beat protocol.send(PackageType.PKG_HEARTBEAT); }
public void sendHeartBeat(object source, ElapsedEventArgs e) { TimeSpan span = DateTime.Now - lastTime; timeout = (int)span.TotalMilliseconds; //check timeout if (timeout > interval * 2) { Trace.TraceInformation("timeout " + timeout + " > " + interval * 2); protocol.getPomeloClient().timeout(); //stop(); return; } //Send heart beat protocol.send(PackageType.PKG_HEARTBEAT); }
public void sendHeartBeat(object source, ElapsedEventArgs e) { TimeSpan span = DateTime.Now - lastTime; timeout = (int)span.TotalMilliseconds; //UnityEngine.Debug.Log("timeout:"+timeout.ToString()); //check timeout if (timeout > interval * 2) { protocol.getPomeloClient().disconnect(); //stop(); return; } //Send heart beat protocol.send(PackageType.PKG_HEARTBEAT); }