-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Connection to AWS using WebSockets fails on Mono #1698
Comments
Just in case this is bumping into the same kind of problem, does it work with the change just mentioned in #1690? |
Unfortunately, the change in #1690 does not make any different for this issue. |
Anyone? I really appreciate any input on this. Thanks! |
Can you try with the latest version of Mono? |
I've upgrade to mono 6.12.0.182. Unfortunately no difference. Please let me know what else I can try. Thanks! |
Please try attaching to the InspectPackage event. It will give you access to the binary packages which are sent over the wire. |
Also please check the URI you are using. I only see "test.mosquitto.org:8081" in your trace but I would expect something similar to "wss://test.mosquitto.org:8081/mqtt" etc. Please share the code you are using in order to prepare the web socket connection. |
Thanks! Adding "wss://" or "/mqtt" to the server address doesn't seem to make any difference. This is the (simplified) code I use to connect and test:
Not sure how to use the InspectPackage, but this is what I have:
It is giving me quite a few errors, but also reveals some data. On Windows the connection is still working. Using "Ubuntu 22.04, Mono 6.12.0.182, WebSockets, to AWS" this is what i see:
As you can see, the InspectPackage output ("CMQTT7XX/USER/123456/bot/8082d8c5-2a70-4c4c-b376-4dc84035d27d") includes the expected text for a connection. I assume the "CMQTT7" is part of the binary data, required for the actual communication? |
Is your AWS server certificate trusted on Ubuntu? For testing, you could try to always trust the server certificate, i.e. add a |
I am pretty sure it is. But I have tried to ignore any certificate errors anyway, by adding this to TlsParameters:
Unfortunately, that gave me an error: So I remove the .CertificateValidationHandler and added this instead:
However, the result still fails with the same error. |
Can you see the There is an open issue here: mono/mono#8660 |
No, the ServerCertificateValidationCallback is never being hit. However, I do believe the certificate is trusted. Any way I can check that? Also, the log shows "Connection with server established" and "Start receiving packets", doesn't that mean the Certificate is already being validated? |
Ah, yes, I think you are right; trust is probably not the issue. |
Thanks @logicaloud . Open for any other suggestions to resolve this issue! |
I did another test on the length of the buffer inside InspectPackage, and I can confirm that both on Windows and Linux they are 69 bytes. So I believe it is correct. |
I tried some things on my windows machine and figured out that the mono executable crashes when using an encrypted web socket connection. Without encryption it works fine. The entire process is crashing without any exception being thrown/shown. |
Thanks Christian! I have upgraded to
but it still fails. So far, I am unable to get the latest nightly build on my Ubuntu machine, I'll continue to try tomorrow. What version is working for you? |
I tried exactly this one:
|
I finally downloaded the latest source code and compiled it myself. The version shows as follows:
Unfortunately, the error remains. |
Sorry but I was not able to figure out why this is not working. I only know that it is related to encryption (not encrypted connections work) and that the send code is blocking forever (the actual connection works). I assume you need to open a ticket at the Mono project instead. |
Ok, thanks for all your help and testing. |
Closing this ticket because I don't think we can help much here and I this seems to be a Mono related problem to me. |
Describe the bug
Connection to AWS using WebSockets fails on Mono
Which component is your bug related to?
I am having a strange issue with MQTTnet on Ubuntu using Mono, when using WebSockets. I have tested a few different scenarios using Windows, Linux and WebSockets/WebSockets4Net:
Windows 11, WebSockets, to either test.mosquitto.org:8081 or AWS (succes):
Windows 11, WebSockets4Net, to either test.mosquitto.org:8081 or AWS (succes):
Ubuntu 22.04, Mono 6.8.0.105, WebSockets, to test.mosquitto.org:8081 (succes):
Ubuntu 22.04, Mono 6.8.0.105, WebSockets, to AWS (fails):
Ubuntu 22.04, Mono 6.8.0.105, WebSockets4Net, to test.mosquitto.org:8081 (fails):
Ubuntu 22.04, Mono 6.8.0.105, WebSockets4Net, to AWS (fails):
Windows always works. But Mono only works with standard WebSockets and the mosquitto server. All other combinations do not (WebSockets to AWS fails, WebSockets4Net fails for both AWS and mosquitto).
Probably totally unrelated, but with Mono, the last ] is missing from the trace ("[CleanSession=True" instead of "[CleanSession=True]").
The text was updated successfully, but these errors were encountered: