Ejemplo n.º 1
0
        /// <summary>
        /// 处理DO请求消息
        /// </summary>
        /// <param name="request">do请求</param>
        private void ProcessDoReqMessage(SIPRequest request)
        {
            //心跳请求
            KeepAliveReq req      = KeepAliveReq.Instance.Read(request.Body);
            VariableType varibale = VariableType.Unknown;

            if (req != null)
            {
                varibale = req.NotifyMsg.Variable;
            }
            if (varibale == VariableType.KeepAlive)
            {
                DoResKeepAlive(request);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// The keep alive service can be used to stop a session timing out.
        /// Every call to the Betfair API returns a token, in the sessionToken
        /// field, that identifies a login session. Every time your
        /// application calls the Betfair API and is returned a sessionToken,
        /// the session timeout is reset to approximately 20 minutes.
        /// After the timeout has passed, the session is expired and you need to login again.
        /// </summary>
        private static void SessionKeepAlive(bool async)
        {
            const string serviceName = "SessionKeepAlive";

            Console.WriteLine("{0}$ API_SERVICE {1}", DateTime.Now, serviceName);
            var request = new KeepAliveReq {
                header = ((APIRequestHeader)GetHeader(true))
            };

            if (async)
            {
                _bfGlobalService.keepAliveAsync(request);
            }
            else
            {
                KeepAliveResp response = _bfGlobalService.keepAlive(request);
                ValidateAPIResponse(serviceName, Convert.ToString(response.header.errorCode),
                                    response.header.sessionToken);
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// The keep alive service can be used to stop a session timing out.
        /// Every call to the Betfair API returns a token, in the sessionToken
        /// field, that identifies a login session. Every time your 
        /// application calls the Betfair API and is returned a sessionToken,
        /// the session timeout is reset to approximately 20 minutes.
        /// After the timeout has passed, the session is expired and you need to login again.
        /// </summary>
        private static void SessionKeepAlive(bool async)
        {
            const string serviceName = "SessionKeepAlive";
            Console.WriteLine("{0}$ API_SERVICE {1}", DateTime.Now, serviceName);
            var request = new KeepAliveReq {header = ((APIRequestHeader) GetHeader(true))};

            if (async)
            {
                _bfGlobalService.keepAliveAsync(request);
            }
            else
            {
                KeepAliveResp response = _bfGlobalService.keepAlive(request);
                ValidateAPIResponse(serviceName, Convert.ToString(response.header.errorCode),
                                    response.header.sessionToken);
            }
        }
Ejemplo n.º 4
0
 /// <remarks/>
 public void keepAliveAsync(KeepAliveReq request, object userState) {
     if ((this.keepAliveOperationCompleted == null)) {
         this.keepAliveOperationCompleted = new System.Threading.SendOrPostCallback(this.OnkeepAliveOperationCompleted);
     }
     this.InvokeAsync("keepAlive", new object[] {
                 request}, this.keepAliveOperationCompleted, userState);
 }
Ejemplo n.º 5
0
 /// <remarks/>
 public void keepAliveAsync(KeepAliveReq request) {
     this.keepAliveAsync(request, null);
 }
Ejemplo n.º 6
0
 public KeepAliveResp keepAlive(KeepAliveReq request) {
     object[] results = this.Invoke("keepAlive", new object[] {
                 request});
     return ((KeepAliveResp)(results[0]));
 }