Not logged in. · Lost password · Register
Forum: MatriX RSS
Avatar
babupers #1
Member since Aug 2016 · 1 post
Group memberships: Members
Show profile · Link to this post
Subject: XMPPClient when Reconnect - onpresence, onrosteritem is not fired
Hi,

I am trying to reconnect to XMPPClient, after it is closed.

The new session is opened and the onlogin callback method is called, but the onpresence, onrosteritem event is not fired. The following is the function I used to reconnect.

  1. public void Login(LoginInfo _LoginInfo, UserProfile _UserProfile, bool _Relogin = false)
  2. {
  3.     try
  4.     {
  5.         this.LoginInfo = _LoginInfo;
  6.         this.UserProfile = _UserProfile;
  7.  
  8.         Util.LoggedInClient = new XmppClient();
  9.  
  10.         Util.LoggedInClient.Uri = new System.Uri(Util.ServerURI);
  11.         Util.LoggedInClient.Transport = Matrix.Net.Transport.Bosh;
  12.  
  13.         if (!_Relogin)
  14.             Util.LoggedInClient.OnLogin += new EventHandler<Matrix.EventArgs>(xmppClient_OnLogin);
  15.         else
  16.             Util.LoggedInClient.OnLogin += new EventHandler<Matrix.EventArgs>(xmppClient_OnReLogin);
  17.  
  18.         Util.LoggedInClient.OnError += new EventHandler<Matrix.ExceptionEventArgs>(xmppClient_OnError);
  19.  
  20.         Util.LoggedInClient.OnRosterEnd += new EventHandler<Matrix.EventArgs>(xmppClient_OnRosterEnd);
  21.         Util.LoggedInClient.OnMessage += new EventHandler<MessageEventArgs>(xmppClient_OnMessage);
  22.  
  23.         Util.LoggedInClient.OnPresence += new System.EventHandler<PresenceEventArgs>(xmppClient_OnPresence);
  24.         Util.LoggedInClient.OnRosterItem += new EventHandler<RosterEventArgs>(xmppClient_OnRosterItem);
  25.         Util.LoggedInClient.OnAuthError += new EventHandler<Matrix.Xmpp.Sasl.SaslEventArgs>(LoggedInClient_OnAuthError);
  26.  
  27.         Util.LoggedInClient.OnClose += new EventHandler<Matrix.EventArgs>(LoggedInClient_OnClose);
  28.  
  29.  
  30.         Util.LoggedInClient.SetUsername(this.LoginInfo.UserId);
  31.         Util.LoggedInClient.SetXmppDomain(Util.ChatDomain);
  32.         Util.LoggedInClient.Password = this.LoginInfo.Password;
  33.  
  34.         Util.LoggedInClient.Status = "Online";
  35.         Util.LoggedInClient.Show = Matrix.Xmpp.Show.Chat;
  36.  
  37.         Util.LoggedInClient.Open();
  38.     }
  39.     catch (Exception ex)
  40.     {
  41.    
  42.     }
  43. }

Please help...

Thanks & Regards
Babu
This post was edited 2 times, last on 2016-08-19, 17:15 by Alex.
Avatar
Alex #2
Member since Feb 2003 · 4296 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
an Xml log would to see if its a problem with your XMPP server, or if the problem is in your code with the events you setup.

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: MatriX RSS