Invalid_Session_Information

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • skit
    Junior Member
    • Apr 2014
    • 7

    #1

    Invalid_Session_Information

    Hi,

    I have developed a simple C# bot that has calls for the KeepAlive function once every 15 minutes.

    However usually after 10 to 12 hours of bot "uptime" I start getting back from the API the "INVALID_SESSION_INFORMATION" error. Which as I read can either be because the session is invalid or expired.
    Question is how can that happen when using KeepAlive? Is there a TTL even for a session that is in constant use and even when using KeepAlive?!
  • betdynamics
    Junior Member
    • Sep 2010
    • 534

    #2
    Are you sure that the KeepAlive function in your bot is working?

    Comment

    • skit
      Junior Member
      • Apr 2014
      • 7

      #3
      Code:
      public static readonly string KeepAliveURL = @"https://identitysso.betfair.com/api/keepAlive";
      
      public void sendKeepAlive()
              {
                  Console.WriteLine("KeepAlive started.");
                  WebRequest request = null;
                  WebResponse response = null;
                  try
                  {
                      do
                      {
                          request = WebRequest.Create(new Uri(Bot.KeepAliveURL));
                          request.Method = "POST";
                          request.ContentType = "application/json-rpc";
                          request.Headers.Add(HttpRequestHeader.AcceptCharset, "ISO-8859-1,utf-8");
                          request.Headers.Add("X-Authentication", this.SSOID);
                          if (!string.IsNullOrEmpty(Bot.APP_KEY))
                          {
                              request.Headers.Add("X-Application", Bot.APP_KEY);
                          }
                          response = request.GetResponse();
                          Console.WriteLine("KeepAlive sent " + ((HttpWebResponse)response).StatusDescription);
                      } while (response == null);
                  }
                  catch (System.Exception ex)
                  {
                      Console.WriteLine("KeepAlive Error" + ex.Message);
                  }
                  response.Close();
              }
      This is the code I'm using. The StatusDescription has always returned "OK".

      (Ill try and actually make it deserialize the response as JSON and read the status property I guess)

      Thank you.
      Last edited by skit; 07-06-2014, 12:10 AM.

      Comment

      Working...
      X