What causes connection abort? - xamarin

On iPhone, sometimes when I open the app, all immediate HttpClient requests fail. I saw a message that said...
Software caused connection abort
Upon retrying, there's no problem.
What could cause this?
It happens when the app is first opened on iPhone and Android and when the app is opened from clicking on a notification. In both of these situations a web request is sent immediately.
Is it possible that the connection is not ready yet and, rather than waiting, it's throwing an exception?

Faced a similar problem today!
I added an await Task.Delay(200); before launching the httprequest (only when app was launched from notification tap) and the issue is fixed.

Related

OpenTok, detect if remote subscriber has poor connection or temporarily disconnected or network disconnected for Android and iOS SDK

We are not able to detect subscribers'/clients' disconnected signal or poor network connection with Android/iOS SDK, however, we are able to detect with OpenTok web (JS).
The below link suggested for the web which is working fine our end too, but we need the same for OpenTok Android and iOS SDK.
Determining if a remote subscriber is temporarily disconnected.
we need sample code to detect poor connection or network disconnected at subscribers end for both Android and iOS. if anybody faced a similar problem and has a workaround then please suggest.
our aim to show messages on the mobile phone if subscribers have poor connection issues or trying to reconnect.
There are analogous re-connection callbacks for Android and iOS as well. Reconnection callbacks get triggered when a client tries to automatically reconnect after losing its connection to an OpenTok session. Otherwise, if a client cannot reconnect, the SessionListener's "disconnected" method gets triggered.
To verify if session reconnect APIs are working fine at your end, we recommend you to implement the necessary callbacks and manually check if the registered callbacks gets triggered or not by disconnecting network and then reconnecting it again.
Please checkout the below link for implementing callback APIs:
Android:
https://tokbox.com/developer/sdks/android/reference/com/opentok/android/Session.ReconnectionListener.html
iOS: https://tokbox.com/developer/sdks/ios/reference/Protocols/OTSessionDelegate.html#//api/name/sessionDidBeginReconnecting
Hope it helps!

What happens with WebSocket connections when a phone's screen locks?

When a phone browser has an open connection, and the user locks the screen, then at a certain point they will no longer have a WebSocket connection.
What events are fired when this happens? Is the WebSocket.onerror or WebSocket.onclose handler called, and if so, does this happen when the screen locks/the app is suspended, or when the app comes back up again?
(And bonus question: is this standardised, or do browsers behave differently, and if so, how?)
I've done some testing myself, and the answer seems to be: no events are fired. Although the connection does drop, no error or close events are fired, not even when the browser comes back up. Therefore, the main way to deal with this appears to be to periodically check the connection status, and reconnect if need be - with exponential back-off in case the connection drops server-side. (Or to have a library do this for you, though I haven't found a properly maintained client-side browser-based WebSocket library that does this yet.)
This seems corroborated by the author of this article:
Mobile devices introduce a new category of connection issues; if a mobile device is locked, goes to sleep or the application is moved to the background, an active WebSocket connection may become unresponsive and not close itself properly.

Is it possible to logout from an app or website on offline mode?

Just wanna gauge your thought on this issue. Recently, I tested an app
and when I logged out in offline mode (i.e. no Internet connection),
the app is, to my amazement, ABLE to log out. Furthermore, the client said it was an expected behavior!
I'm a bit bemused because usually when we log out from an app/website by disabling the Internet connection, it should throw out an exception like "There is no Internet connection", right? Surely there must be a validation token in place.
Many thanks indeed.

Microsoft Bot (webchat channel): 500 Internal Server error: failed to send message

We have embedded a Bot on a web page through the web chat channel, if the Bot is idle for 10 minutes or so and then a question is asked, the Bot does not respond to it, however when the same question is asked again immediately it responds as expected.
On investigating the network capture, we observed the response received when the question was asked for the first time was 500: Internal Server Error with message as "failed to send message"
Are you running the bot in Azure? If so, make sure you have "AlwaysOn" enabled; otherwise the web app will be unloaded if it's idle for a period of time. Check this for a similar problem.
Always On. By default, web apps are unloaded if they are idle for some period of time. This lets the system conserve resources. In Basic or Standard mode, you can enable Always On to keep the app loaded all the time. If your app runs continuous web jobs, you should enable Always On, or the web jobs may not run reliably.
You can read more about the web sites configuration here.

Browser not sending any data (no errors)

So I have a faye server and a rails web application. It all worked fine till recently. Now the browser is not sending anythin to the server. There a no error not on the server not even in browser (I can create an instance of Faye.Client just fine). But when I do publish the server gets nothing. It doesn't even get anythin on the meta channel, like connect or subscribe. The thing is that if I send something with curl the server shows the message (cause I'm logging it).
I can't pin point the problem. :/
Make sure the code to send messages is being reached. Make sure your client is still valid. Test an earlier code version etc. Just a few ideas.
Solved the problem. The url to which faye was connecting was not OK, but faye failed silently because the url responded. :/

Resources