Not logged in. · Lost password · Register
Forum: MatriX RSS
Avatar
zco_dev #1
Member since May 2015 · 3 posts
Group memberships: Members
Show profile · Link to this post
Subject: XMPP connection stream becoming inactive very often.
We are getting the error "Matrix.XmppStreamException: Unable to send data. The XMPP Stream is inactive" when we are trying to Discover a PubSub node or when we are publishing a message to PubSub node. We are getting this issue very often and not sure how to proceed.

Please find below the code that we use to open a connection : -

  1. var wait = new ManualResetEvent(false);
  2. var xmppConnection = new XmppClient();
  3.  
  4. IQResponse response = new IQResponse();
  5. response.Type = IQType.error;
  6.  
  7. xmppConnection.SetXmppDomain("#Server");
  8. xmppConnection.SetUsername("#Admin User name");
  9. xmppConnection.Password = "#Password";
  10. xmppConnection.KeepAliveInterval = 30;
  11. xmppConnection.OnLogin += delegate(object sender, Matrix.EventArgs e)
  12. {
  13.     logger.Information("Open new connection : Success.");
  14.      wait.Set();
  15. };
  16.  
  17. xmppConnection.OnError += delegate(object sender, Matrix.ExceptionEventArgs e)
  18. {
  19.     logger.Error("OnError message : "+ e.Exception);
  20.     wait.Set();
  21.  
  22. };
  23. xmppConnection.OnAuthError += delegate(object sender, Matrix.Xmpp.Sasl.SaslEventArgs e)
  24. {
  25.  
  26.     logger.Error("OnAuthError message : " + e.Exception);
  27.     wait.Set();
  28.  
  29. };
  30.  
  31. xmppConnection.Open();
  32. wait.WaitOne();
This post was edited 4 times, last on 2015-05-07, 15:44 by Alex.
Avatar
Alex #2
Member since Feb 2003 · 4297 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
you get this exception when you try to call a Send and the Xmpp connection is not active (closed).

When the Xmpp connection gets closed you should get an OnClose event. After an OnClose you should not try to send any data until you have recovered your session and it is in a good state again.

It looks like for some reason your connection gets closed, and you try to send data after the OnClose. So we have to find out why your connection is getting closed.
The Xml debug would help, normally there you can see when the connections gets closed.

  • try to subscribe to OnClose and all OnError events
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