Not logged in. · Lost password · Register
Forum: MatriX and XmppDotNet RSS
Reggie.Meisler #1
Member since Jun 2021 · 3 posts
Group memberships: Members
Show profile · Link to this post
Subject: Trouble upgrading from MatriX to vNext
Hey friends,

So I have been using the legacy MatriX client and have been enjoying it, but I am now looking to upgrade to MatriX vNext so that my company can purchase a commercial use license. The way the previous MatriX client was installed was by simply dropping a dll into our Unity Project source, and the person who did this installation is on longer at the company. :(

Based on my research, it seems like the only way to use MatriX vNext is through the use of a package manager called NuGet, but NuGet seems Windows specific and we do all of our development work on Mac. After a little digging, I was able to find a Unity-editor style client for NuGet and install the latest version of MatriX vNext!

Sadly however, after squelching all of our incompatibility errors, I now get this:

https://ibb.co/82zsvtq <- Image

Does anyone have any experience with this issue? This has me stumped.



I am considering trying to just pull in all the source code as raw files (using the MatriX source on git), including dependencies if I can't figure this out soon, but that seems so lame.
This post was edited on 2021-06-15, 02:56 by Reggie.Meisler.
Avatar
Alex #2
Member since Feb 2003 · 4449 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
You Stacktrace is not very useful. There is not a lot of information in it.

NuGet packages are just zip archives. You can always download them manual from the NuGet website and extract the dlls you need from them. Also NuGet is cross platform and works on any platform with .NET Core.

Alex
Reggie.Meisler #3
Member since Jun 2021 · 3 posts
Group memberships: Members
Show profile · Link to this post
I was able to get farther along by turning off Unity's reference validation feature, but now I'm stuck on a static name resolver issue. I have this:

  1. xmppClient = new XmppClient {
  2.     Username = userName,
  3.     Password = password,
  4.     XmppDomain = Configuration.XmppDomain,
  5.    
  6.     HostnameResolver = new StaticNameResolver(
  7.         "gcs-chatlovin-dev.las1-c.mzsrv.net",
  8.         5443,
  9.         false
  10.     )
  11. };

And with this I get a connection timeout. I know that the full url needs to be: ws://gcs-chatlovin-dev.las1-c.mzsrv.net/ws in order to hit my websocket endpoint, but I get resolver errors if I do that. Any ideas?
This post was edited on 2021-06-16, 00:57 by Alex.
Reggie.Meisler #4
Member since Jun 2021 · 3 posts
Group memberships: Members
Show profile · Link to this post
Ah, guessing I need this: https://github.com/matrix-xmpp/xmpp-websocket-proxy

Will give that a try.

UPDATE:
Nope that seems like it's just a proxy for XMPP TCP servers... :(
This post was edited on 2021-06-16, 00:37 by Reggie.Meisler.
Avatar
Alex #5
Member since Feb 2003 · 4449 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Websockets are not supported by the current release versions of MatriX vNext. Its supported on the current development branch net5 which you can find here:
https://github.com/matrix-xmpp/matrix-vnext/tree/net5

You either have to use TCP sockets as transport or build from sources I referenced above.

Alex
Avatar
fr3akb0y #6
Member since Sep 2017 · 22 posts
Group memberships: Members
Show profile · Link to this post
Hello Alex,

I tried https://github.com/matrix-xmpp/matrix-vnext/tree/net5  to connect using websocket
and i was getting error of argument null exception (Uri) in WebSocketTransport.cs Class


Here is what i tried

  1.  var xmppClient = new XmppClient(
  2.         conf =>
  3.         {
  4.             //conf.UseSocketTransport();
  5.  
  6.             conf.UseWebSocketTransport();
  7.             conf.AutoReconnect = true;
  8.             conf.UseAutoReconnect();
  9.            
  10.  
  11.         },
  12.         (handlers, client) => handlers.Add(new XmppLoggingHandler(client)))
  13.     {
  14.         Jid = "USER@XXX.xxx",
  15.         Password = "Password"
  16.        
  17. };


Also tried matrix Nugget package & there were no responses at all
Here is the code i used :
  1. xmppClient.Transport = Matrix.Net.Transport.WebSocket;
  2. xmppClient.Uri = new Uri("wss://xxxx.xx:5333/server");
  3. xmppClient.SetUsername( "USER");
  4. xmppClient.Hostname = "XXXX.xx";
  5. xmppClient.Password = "PASSWORD";
  6. xmppClient.SetXmppDomain("XXXX.xx");
  7. xmppClient.Show = Matrix.Xmpp.Show.Chat;
  8. xmppClient.AutoPresence = true;
  9. xmppClient.AutoRoster = true;
  10. xmppClient.AutoReplyToPing = true;
  11. xmppClient.Open()

what is the issue actually? is there any wrong with these codes or i have to change MatriX version?
This post was edited on 2021-07-19, 09:57 by fr3akb0y.
Avatar
Alex #7
Member since Feb 2003 · 4449 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
MatriX vNext is trying to find your websocket URI automatically based on:
XEP-0156: Discovering Alternative XMPP Connection Methods

When your server deployment is not hosting a xml or json file as defined in XEP-0156 then you either need to:
1) change your server configuration
2) provide a StaticNameResolver with your Uri when you configure the XmppClient

eg:

  1. var xmppClient = new XmppClient(
  2. conf =>
  3. {
  4.    conf
  5.       .UseWebSocketTransport(
  6.          new StaticNameResolver(new Uri("wss://xxxx.xx:5333/server"))
  7.       );
  8. };

Alex
Avatar
fr3akb0y #8
Member since Sep 2017 · 22 posts
Group memberships: Members
Show profile · Link to this post
Still No luck, Tried many way as possible. Now it's getting connected & disconnecting frequently



State changed: Connected
State changed: Disconnected
The thread 0x7c0 has exited with code 0 (0x0).
State changed: Connected
Exception thrown: 'System.ArgumentException' in System.Private.CoreLib.dll

and finally throwing timed out error


System.TimeoutException
  HResult=0x80131505
  Message=The operation has timed out.
  Source=System.Private.CoreLib
  StackTrace:
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() in /_/src/libraries/System.Private.CoreLib/src/System/Runtime/ExceptionServices/ExceptionDispatchInfo.cs:line 56
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) in /_/src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/TaskAwaiter.cs:line 188
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) in /_/src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/TaskAwaiter.cs:line 150
   at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult() in /_/src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/TaskAwaiter.cs:line 551
   at Matrix.XmppXElementFilter.<SendAsync>d__29`1.MoveNext() in D:\Test\matrix-vnext-net5\matrix-vnext-net5\src\Matrix\XmppXElementFilter.cs:line 294
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() in /_/src/libraries/System.Private.CoreLib/src/System/Runtime/ExceptionServices/ExceptionDispatchInfo.cs:line 56
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) in /_/src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/TaskAwaiter.cs:line 188
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) in /_/src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/TaskAwaiter.cs:line 150
   at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult() in /_/src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/TaskAwaiter.cs:line 551
   at Matrix.XmppXElementFilter.<SendAsync>d__21`2.MoveNext() in D:\Test\matrix-vnext-net5\matrix-vnext-net5\src\Matrix\XmppXElementFilter.cs:line 154
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() in /_/src/libraries/System.Private.CoreLib/src/System/Runtime/ExceptionServices/ExceptionDispatchInfo.cs:line 56
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) in /_/src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/TaskAwaiter.cs:line 188
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) in /_/src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/TaskAwaiter.cs:line 150
   at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult() in /_/src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/TaskAwaiter.cs:line 551
   at Matrix.XmppConnection.<SendAsync>d__26`2.MoveNext() in D:\Test\matrix-vnext-net5\matrix-vnext-net5\src\Matrix\XmppConnection.cs:line 133
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() in /_/src/libraries/System.Private.CoreLib/src/System/Runtime/ExceptionServices/ExceptionDispatchInfo.cs:line 56
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) in /_/src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/TaskAwaiter.cs:line 188
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) in /_/src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/TaskAwaiter.cs:line 150
   at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult() in /_/src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/TaskAwaiter.cs:line 551
   at Matrix.XmppClient.<SendStreamHeaderAsync>d__40.MoveNext() in D:\Test\matrix-vnext-net5\matrix-vnext-net5\src\Matrix\XmppClient.cs:line 329
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() in /_/src/libraries/System.Private.CoreLib/src/System/Runtime/ExceptionServices/ExceptionDispatchInfo.cs:line 56
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) in /_/src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/TaskAwaiter.cs:line 188
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) in /_/src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/TaskAwaiter.cs:line 150
   at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult() in /_/src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/TaskAwaiter.cs:line 551
   at Matrix.XmppClient.<SendStreamHeaderAsync>d__39.MoveNext() in D:\Test\matrix-vnext-net5\matrix-vnext-net5\src\Matrix\XmppClient.cs:line 323
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() in /_/src/libraries/System.Private.CoreLib/src/System/Runtime/ExceptionServices/ExceptionDispatchInfo.cs:line 56
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) in /_/src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/TaskAwaiter.cs:line 188
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) in /_/src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/TaskAwaiter.cs:line 150
   at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult() in /_/src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/TaskAwaiter.cs:line 551
   at Matrix.XmppClient.<ConnectAsync>d__30.MoveNext() in D:\Test\matrix-vnext-net5\matrix-vnext-net5\src\Matrix\XmppClient.cs:line 140
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() in /_/src/libraries/System.Private.CoreLib/src/System/Runtime/ExceptionServices/ExceptionDispatchInfo.cs:line 56
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) in /_/src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/TaskAwaiter.cs:line 188
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) in /_/src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/TaskAwaiter.cs:line 150
   at Matrix.XmppClient.<ConnectAsync>d__29.MoveNext() in D:\Test\matrix-vnext-net5\matrix-vnext-net5\src\Matrix\XmppClient.cs:line 120
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() in /_/src/libraries/System.Private.CoreLib/src/System/Runtime/ExceptionServices/ExceptionDispatchInfo.cs:line 56
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) in /_/src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/TaskAwaiter.cs:line 188
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) in /_/src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/TaskAwaiter.cs:line 150
   at System.Runtime.CompilerServices.TaskAwaiter.GetResult() in /_/src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/TaskAwaiter.cs:line 105
   at ConsoleClient.Program.<Main>d__0.MoveNext() in D:\Test\matrix-vnext-net5\matrix-vnext-net5\examples\ConsoleClient\Program.cs:line 81
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() in /_/src/libraries/System.Private.CoreLib/src/System/Runtime/ExceptionServices/ExceptionDispatchInfo.cs:line 56
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) in /_/src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/TaskAwaiter.cs:line 188
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) in /_/src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/TaskAwaiter.cs:line 150
   at System.Runtime.CompilerServices.TaskAwaiter.GetResult() in /_/src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/TaskAwaiter.cs:line 105
   at ConsoleClient.Program.<Main>(String[] args)

  This exception was originally thrown at this call stack:
    System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() in ExceptionDispatchInfo.cs
    System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(System.Threading.Tasks.Task) in TaskAwaiter.cs
    System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(System.Threading.Tasks.Task) in TaskAwaiter.cs
    System.Runtime.CompilerServices.ConfiguredTaskAwaitable<TResult>.ConfiguredTaskAwaiter.GetResult() in TaskAwaiter.cs
    Matrix.XmppXElementFilter.SendAsync<T>(System.Func<System.Threading.Tasks.Task>, System.Func<Matrix.Xml.XmppXElement, bool>, int, System.Threading.CancellationToken) in XmppXElementFilter.cs
    System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() in ExceptionDispatchInfo.cs
    System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(System.Threading.Tasks.Task) in TaskAwaiter.cs
    System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(System.Threading.Tasks.Task) in TaskAwaiter.cs
    System.Runtime.CompilerServices.ConfiguredTaskAwaitable<TResult>.ConfiguredTaskAwaiter.GetResult() in TaskAwaiter.cs
    Matrix.XmppXElementFilter.SendAsync<T1, T2>(Matrix.Xml.XmppXElement, int, System.Threading.CancellationToken) in XmppXElementFilter.cs
    ...
    [Call Stack Truncated]
This post was edited on 2021-07-19, 12:12 by fr3akb0y.
Avatar
Alex #9
Member since Feb 2003 · 4449 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
you can try to debug the code and see why you are getting the System.ArgumentException.
Websockets work fine for us with many different server implementations.

When you cannot solve it then please provide a test case with a public endpoint of your server so that we can verify,

Alex
Avatar
fr3akb0y #10
Member since Sep 2017 · 22 posts
Group memberships: Members
Show profile · Link to this post
Here is the code what am trying

  1. var xmppClient = new XmppClient(
  2.                 conf =>
  3.                 {
  4.                     //conf.UseSocketTransport();
  5.  
  6.                     conf.AutoReconnect = true;
  7.                     conf.UseAutoReconnect();
  8.  
  9.                     conf.UseWebSocketTransport(
  10.          new Matrix.Transport.StaticNameResolver(new Uri("wss://xxxx.xx:5333/server")));
  11.  
  12.  
  13.                 },
  14.                 (handlers, client) => handlers.Add(new XmppLoggingHandler(client)))
  15.             {
  16.                 Jid = "USER@xxxx.xx",
  17.                 Password = "PASSWORD"
  18.                
  19.         };
  20.  
  21.             xmppClient.StateChanged.Subscribe(v => {
  22.                 Debug.WriteLine($"State changed: {v}");
  23.             });
This post was edited on 2021-07-19, 13:24 by fr3akb0y.
Avatar
Alex #11
Member since Feb 2003 · 4449 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Are you sure that your websocket Uri is correct?
Usually the path by default is /ws or /websocket and not /server.

Alex
Avatar
fr3akb0y #12
Member since Sep 2017 · 22 posts
Group memberships: Members
Show profile · Link to this post
Yes this is correct & its getting connected
Avatar
Alex #13
Member since Feb 2003 · 4449 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
you server does not properly reply to the websocket <open/> xml packet under the Uri you provided to me.
Either the Url is wrong or something is broken on your websocket setup on the server.
Does not look like a problem in MatriX to me. Feel free to try other existing websocket xmpp clients or libraries.

Alex
Avatar
fr3akb0y #14
Member since Sep 2017 · 22 posts
Group memberships: Members
Show profile · Link to this post
Thank you so much for your valuable time. I figured it out and  it's not MatriX issue
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: