Not logged in. · Lost password · Register
Forum: agsXMPP RSS
Avatar
bilalkhan #1
Member since Oct 2016 · 81 posts · Location: Pakistan
Group memberships: Members
Show profile · Link to this post
Subject: agsxmpp library which event trigger when i drop internet connection
agsxmpp library which event trigger when i drop internet connection, when a internet connection is drop from client side. socket remain open or get close?
Avatar
Alex #2
Member since Feb 2003 · 4449 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
You get the OnClose event when MatriX detects the socket loss.
Avatar
bilalkhan #3
Member since Oct 2016 · 81 posts · Location: Pakistan
Group memberships: Members
Show profile · Link to this post
AutoResolveConnectServer=true

what is the time interval for above line? can i display some message on front end client is finding server due to disconnectivity?
or any event which assure me connection drop, in agsxmpp on close is not working properly?
Avatar
Alex #4
Member since Feb 2003 · 4449 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Why is OnClose not working properly?
Avatar
bilalkhan #5
Member since Oct 2016 · 81 posts · Location: Pakistan
Group memberships: Members
Show profile · Link to this post
  1. private void OnClose(object sender)
  2. {
  3. }

call when server get down. when i up the server i sttill get offline to other user? should i write some code here?


when i am opening connection to server i write

  1. _xmppClientConnection.AutoResolveConnectServer = true;
  2. _xmppClientConnection.KeepAlive = true;
  3. _xmppClientConnection.KeepAliveInterval = 50;


when server get down and then up i still get offline to other user what am doing wrong??????
This post was edited 3 times, last on 2016-11-14, 10:11 by Alex.
Avatar
Alex #6
Member since Feb 2003 · 4449 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Quote by bilalkhan:
call when server get down. when i up the server i sttill get offline to other user? should i write some code here?

yes you should. agsXMPP does not reconnect automatically on connection loss. Its your task to implement the reconnect logic.

Alex
Avatar
bilalkhan #7
Member since Oct 2016 · 81 posts · Location: Pakistan
Group memberships: Members
Show profile · Link to this post
thanks alex, i am writing my own implementation, however am facing an issue single event on multiple behavior, how can i differentiate the state of behavior on which onclose get fired?


//this event calls when some one enter wrong message or password, on wrong server id it does not get fire
//Scenario 1:how can i detect a normal behaviour user have sucessfull logged in and then logout
//Scenario 2: if the user get disconnect, onclose get call(server shut down)
//Scenario 3: when some enter wrong password onclose get call
private void OnClose(object sender)
        {
            //how can i differentiate the behaviour
           //scenario 1 do something scneario2 do something else scenario 3 do something more else
         }


below is my code i have a timer class and it's function elapsed


 private void OnClose(object sender)//this event calls when some one enter wrong message or password, on wrong server id it does not get fire
        {

           string connectionstate= ((XmppClientConnection)sender).XmppConnectionState.ToString();
      
                _myTimer.Start(); //how can i differentiate the normal login logout
       
        }


  private void MyTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
        {
 _xmppClientConnection.OnLogin -= OnLogin;
            if(_xmppClientConnection.XmppConnectionState.Equals(XmppConnectionState.SessionStarted) || _xmppClientConnection.XmppConnectionState.Equals(XmppConnectionState.Connected))
            {
                _myTimer.Elapsed -= MyTimer_Elapsed;
                _myTimer.Stop();
               
            }
            _xmppClientConnection.Open();
        }

thanks in advance :)
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