예제 #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)
        {
            _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;
 }