Not logged in. · Lost password · Register
Forum: MatriX RSS
Finesse Notification
uzair2299 #1
Member for 2 months · 1 post
Group memberships: Members
Show profile · Link to this post
Subject: Finesse Notification
I am new to MatriX. I want to get pidgin notifications/events in my C# .NET console application.

With this code implementation, I am getting exception  M_xmppClient_OnError event (BOSH exception ,Message = "The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel.")
  1. XmppClient m_xmppClient = new XmppClient();
  2. m_xmppClient.Transport = Matrix.Net.Transport.Bosh;
  3. m_xmppClient.Hostname = "abc.com";
  4. m_xmppClient.Username = "user_name";
  5. m_xmppClient.Password = "password";
  6. m_xmppClient.Port = 5222;
  7.  
  8. m_xmppClient.SetXmppDomain("https://abc.com");
  9. m_xmppClient.AutoRoster = true;
  10. m_xmppClient.AutoPresence = true;
  11. m_xmppClient.OnMessage += M_xmppClient_OnMessage;
  12. m_xmppClient.OnReceiveXml += M_xmppClient_OnReceiveXml;
  13. m_xmppClient.OnBind += M_xmppClient_OnBind;
  14. m_xmppClient.OnValidateCertificate += M_xmppClient_OnValidateCertificate;
  15. m_xmppClient.OnLogin += M_xmppClient_OnLogin;
  16. m_xmppClient.OnError += M_xmppClient_OnError;
  17. m_xmppClient.OnAuthError += M_xmppClient_OnAuthError;
  18. m_xmppClient.Uri = new System.Uri("https://abc.com:7552/http-bind/");
  19. m_xmppClient.KeepAliveInterval = 60;
  20. m_xmppClient.Open();
  21.  
  22. PubSubManager mgr = new PubSubManager(m_xmppClient);
  23. mgr.OnEvent += Mgr_OnEvent;
  24.  
  25. private void M_xmppClient_OnAuthError(object sender, Matrix.Xmpp.Sasl.SaslEventArgs e)
  26. {
  27.     Console.WriteLine(e.Exception);
  28. }
  29.  
  30. private void M_xmppClient_OnError(object sender, Matrix.ExceptionEventArgs e)
  31. {
  32.     Console.WriteLine(e.Exception);
  33. }
  34.  
  35. private void M_xmppClient_OnLogin(object sender, Matrix.EventArgs e)
  36. {
  37.     Console.WriteLine(e.State);
  38. }
  39.  
  40. private void M_xmppClient_OnValidateCertificate(object sender, Matrix.CertificateEventArgs e)
  41. {
  42.     e.AcceptCertificate = true;
  43. }
  44.  
  45. private void M_xmppClient_OnBind(object sender, Matrix.JidEventArgs e)
  46. {
  47.  
  48.     Console.WriteLine("On bind:  " + e.Jid);
  49. }
  50.  
  51. private void Mgr_OnEvent(object sender, MessageEventArgs e)
  52. {
  53.     Console.WriteLine(e.Message);
  54. }
  55.  
  56. private void M_xmppClient_OnReceiveXml(object sender, Matrix.TextEventArgs e)
  57. {
  58.     Console.WriteLine(e.Text + e.State);
  59. }
  60.  
  61. private void M_xmppClient_OnMessage(object sender, MessageEventArgs e)
  62. {
  63.     Console.WriteLine(e.Message.Value);
  64.     Console.WriteLine(e.Message.Body);
  65. }
Any help with code implementation. Thank you
This post was edited on 2021-11-12, 08:55 by uzair2299.
Avatar
Alex #2
Member since Feb 2003 · 4438 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
It looks like you are using BOSH as transport layer. And according to the exception there seems to be a SSL/TLS issue with your server.
When you are using an invalid Tls certificate for some reason then you can handle it yourself for BOSH connections with the .NET ServicePointManager.ServerCertificateValidationCallback.
By default connections with invalid and untrusted certificates get rejected in .NET
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