Open janusw opened 4 months ago
This issue is somewhat similar to #1691: The error message is the same, but the reconnection interval and also the workaround is different, so I assume it has a different root cause.
However, in https://github.com/dotnet/MQTTnet/issues/1691#issuecomment-1473677280 @logicaloud reports that he can reproduce the problem, but only the KeepAliveInterval
workaround works for him, not the MaxServicePointIdleTime
one.
I really wonder what could cause this strange phenomenon, and why it's different between Xamarin/NetStandard and MAUI/.NET8. Maybe some behavior of System.Net.Websockets
has changed?
Further ideas, anyone? Anything else I can do to debug this? @chkr1011
Describe the bug
I have a mobile app (previously Xamarin.Forms, now MAUI) which connects to an ActiveMQ Artemis broker via MQTT over (secure) WebSocket, using MQTTNet v4.3.3. With Xamarin.Forms this always worked well, but after switching to MAUI (.NET 7 or 8), I see the following error every 30 seconds, leading to a reconnection:
I have observed such errors when running on Android or iOS. They also occur if I continuously transmit data (either sending or receiving).
Which component is your bug related to?
Code example
I'm basically setting up the client like this:
Workaround
I found that the problem goes away if I use
.WithKeepAliveInterval(TimeSpan.Zero)
on the WebSocket. It somehow seems to be related to the WebSocket keepalive interval (which is 30s by default).