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: xmpp on error
when this function get called.?? 

  1. private void OnError(object sender, Exception ex)
  2. {
  3.  
  4.     var context = GlobalHost.ConnectionManager.GetHubContext<ChatHub>();
  5.     foreach (string connectionId in ChatHub.GetUserConnections(((XmppClientConnection)sender).Username))
  6.     {
  7.         context.Clients.Client(connectionId).showServerError("Server not reachable. Please try later.!");
  8.     }
  9. }
This post was edited on 2016-11-24, 12:45 by Alex.
Edit reason: added code formatting
Avatar
Alex #2
Member since Feb 2003 · 4449 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
This is event get called when:

  • there are unhandled exceptions on your code, we forward them to you in this event. Because most unhandled exception bubble up to agsXMPP
  • Socket exception in MatriX get also forwarded here.

But you should not rely on this event. Its more informational. When an exception occurs which causes a connection loss then this is always followed by the OnClose event. And you should react on the OnClose event only.

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