示例#1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="routePath">Call method path, ex:className.method</param>
        /// <param name="param"></param>
        /// <param name="callback"></param>
        public void Call(string routePath, RequestParam param, Action <RemotePackage> callback)
        {
            int msgId = Interlocked.Increment(ref _msgId);

            param["MsgId"]    = msgId;
            param["route"]    = routePath;
            param["Sid"]      = _sessionId;
            param["Uid"]      = _userId;
            param["ActionId"] = 0;
            param["ssid"]     = _proxySessionId;
            param["isproxy"]  = true;
            param["proxyId"]  = _proxyId;
            string post = string.Format("d={0}", HttpUtility.UrlEncode(param.ToPostString()));

            if (_client.IsSocket)
            {
                post = "?" + post;
            }
            var responsePack = new RemotePackage {
                MsgId = _msgId, RouteName = routePath
            };

            responsePack.Callback += callback;
            PutToWaitQueue(responsePack);
            _client.Send(post);
        }
示例#2
0
 private void PutToWaitQueue(RemotePackage package)
 {
     _packagePools[package.MsgId] = package;
 }
示例#3
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="routePath">Call method path, ex:className.method</param>
 /// <param name="param"></param>
 /// <param name="callback"></param>
 public void Call(string routePath, RequestParam param, Action<RemotePackage> callback)
 {
     _msgId++;
     param["MsgId"] = _msgId;
     param["route"] = routePath;
     param["Sid"] = _sessionId;
     param["Uid"] = _userId;
     param["ActionId"] = 0;
     param["ssid"] = _proxySessionId;
     param["isproxy"] = true;
     param["proxyId"] = _proxyId;
     string post = string.Format("d={0}", HttpUtility.UrlEncode(param.ToPostString()));
     if (_client.IsSocket)
     {
         post = "?" + post;
     }
     var responsePack = new RemotePackage { MsgId = _msgId, RouteName = routePath };
     responsePack.Callback += callback;
     PutToWaitQueue(responsePack);
     _client.Send(post);
 }
示例#4
0
 private void PutToWaitQueue(RemotePackage package)
 {
     _packagePools[package.MsgId] = package;
 }