Not logged in. · Lost password · Register
Forum: agsXMPP RSS
One request instead of two
Avatar
Koterpillar #1
Member since May 2007 · 32 posts · Location: Russia
Group memberships: Members
Show profile · Link to this post
Subject: Connect to Google Talk faster!
Connection to Google Talk from agsXMPP over GPRS is way slow. But looking at the agsXMPP code, I noticed you're getting SID and LSID first and Auth after, with two HTTP requests. However, Google documentation suggests abandoning SID/LSID, so I modified the X-Google-Token code, see below.
nebohodimo IM developer
The author has attached one file to this post:
XGoogleTokenMechanism.cs 5.8 kBytes
You have no permission to open this file.
Avatar
Alex #2
Member since Feb 2003 · 4317 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Hello Koterpillar,

it's a while ago now since I added the Google X-TOKEN stuff. And i think the 2 HTTPS requests were required. I agree that it's slow on smart devices. I will take a look at the new documents from Google again and merge your code to the SVN copy if you give us the permissions.

Alex
Avatar
Alex #3
Member since Feb 2003 · 4317 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
In reply to post #1
Quote by Koterpillar:
... Google documentation suggests abandoning SID/LSID
Do you have a link to this documentation?

Thanks Alex
Avatar
Koterpillar #4
Member since May 2007 · 32 posts · Location: Russia
Group memberships: Members
Show profile · Link to this post
http://code.google.com/apis/accounts/AuthForInstalledApps.…
A success response contains the authentication token, labeled "Auth", in the body of the response. Your application must reference this token in each request to the Google service for this user. Additional cookies, labeled "SID" and "LSID", are not currently active and should not be used.

And of course you have my permissions to merge it... I release it into public domain, or is there something else I need to say?
nebohodimo IM developer
This post was edited on 2007-06-23, 09:26 by Koterpillar.
Avatar
Koterpillar #5
Member since May 2007 · 32 posts · Location: Russia
Group memberships: Members
Show profile · Link to this post
Subject: WebException
  1.         private void OnGetClientAuthResponse(IAsyncResult result)
  2.         {
  3.             WebRequest request = (WebRequest)result.AsyncState;
  4.             try
  5.             {
  6.                 HttpWebResponse response = (HttpWebResponse)request.EndGetResponse(result);
  7.  
  8.                 if (response.StatusCode == HttpStatusCode.OK)
  9.                 {
  10.                     Stream dataStream = response.GetResponseStream();
  11.  
  12.                     ParseClientAuthResponse(dataStream);
  13.  
  14.                     dataStream.Close();
  15.                     response.Close();
  16.  
  17.                     _Base64Token = GetToken(_Auth);
  18.                     DoSaslAuth();
  19.                 }
  20.                 else
  21.                     base.XmppClientConnection.Close();
  22.             }
  23.             catch (WebException ex)
  24.             {
  25.                 if(((HttpWebResponse)ex.Response).StatusCode == HttpStatusCode.Forbidden)
  26.                     base.XmppClientConnection.FireOnAuthError(null);
  27.                 base.XmppClientConnection.Close();
  28.             }
  29.         }
In the original code, WebExceptions are not handled at all - I added some (hopefully correct) handling of "Forbidden" and (all other =) network errors. But I'm unsure about what to pass to FireOnAuthError as a parameter...
nebohodimo IM developer
This post was edited on 2007-07-01, 10:17 by Koterpillar.
Avatar
Alex #6
Member since Feb 2003 · 4317 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Hello Koterpillar,

sorry we were very bus< this week and had no time yet to work on Google X-TOKEN and check in the new code.
Normally the Xml stanza is passes with the auth error. But in this case there is no xml stanza and null is OK.

We implemented the X-TOKEN because the CF still supports no SSL/TLS sockets, and this is the only way to connect to Google Talk without SSL/TLS.

Alex
Close Smaller – Larger + Reply to this post:
Verification code: VeriCode Please enter the word from the image into the text field below. (Type the letters only, lower case is okay.)
Smileys: :-) ;-) :-D :-p :blush: :cool: :rolleyes: :huh: :-/ <_< :-( :'( :#: :scared: 8-( :nuts: :-O
Special characters:
Forum: agsXMPP RSS