Not logged in. · Lost password · Register
Forum: XMPP XMPP protocol RSS
ayyrk #1
Member since Jul 2007 · 92 posts
Group memberships: Members, Premium
Show profile · Link to this post
Subject: Login and Presence
Hello,

I'd like to reduce network traffic by not re-downloading my roster every time OnLogin is called.

Currently I SendMyPresence in the OnLogin callback. I believe that triggers the server to send me my roster.

On these power saving WM5 devices the socket is periodically closed. I automatically reconnect and re-download the roster.

The general question is: What is the most network-traffic-conserving way to keep the roster up to date?


Thanks!!
Avatar
Alex #2
Member since Feb 2003 · 2700 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
no you are wrong.
The Roster will be requested automaticlly from the SDK when AutoRoster of XmppClientConnection is true.
If you set it to false it will not be requested automatically. You can cache the roster and sync it manual from time to time.

Alex
Alexander Gnauck
AG-Software
kevin #3
User title: kevin
Member since Dec 2007 · 13 posts · Location: chengdu.china
Group memberships: Members
Show profile · Link to this post
how can I get the roster and this prensence of roster when I set the AutoRoster false?
Avatar
Alex #4
Member since Feb 2003 · 2700 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
you get the presence of your contacts after sending your own presence to the server. It does not matter if you requested your own roster or not.

To request the roster use the RequestRoster function of XmppClientConnection or the following code directly in your application.
  1. public void RequestRoster()
  2. {      
  3.     RosterIq iq = new RosterIq(IqType.get);
  4.     xmppCon.IqGrabber.Send(iq, new IqCB(OnRosterIQ), null);
  5. }
  6.  
  7. private void OnRosterIQ(IQ iq)
  8. {         
  9.     Roster r = iq.Query as Roster;
  10.     if (r != null)
  11.     {
  12.         foreach (RosterItem i in r.GetRoster())
  13.         {
  14.             // loop contacts
  15.         }
  16.     }
  17. }

Alex
Alexander Gnauck
AG-Software
kevin #5
User title: kevin
Member since Dec 2007 · 13 posts · Location: chengdu.china
Group memberships: Members
Show profile · Link to this post
Alex,thank you.
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: XMPP XMPP protocol RSS