Decrease MobileServiceClient InvokeAPI timeout - xamarin

I'm using Xamarin to connect to Azure Mobile Services on Android and iOS. When we have a good mobile connection, everything is fine. However, when the mobile connection is slow the default timeout of 60 seconds has a negative impact on our users because it may take up to that long to indicate to the user that their action has not completed.
My question is how to decrease the timeout for InvokeAPI and MobileServiceClient?

You have to override the default timeout of Android and iOS HttpClient.
It's not possible to set the timeout in your shared code (PCL).

Related

Why doesn't my socket.io project on Heroku sleep?

It's a Node.js app serving a React app. I'm using free dynos so the app should sleep after not receiving any request, but it seems to be always on. I checked the billing on Heroku and it's consuming a significant amount of hours.
I would be fine waiting for the app to load up, but it won't sleep. Perhaps it has something to do with socket.io constantly pinging the server while no client is connected?
I only find topics on how to prevent sleeping, totally opposite of my intention. I also have another socket.io app on Heroku, but that one does sleep like expected.
Edit: The app logs tell that there are two socket connections made at the same time every 30 minutes, my app seems to be pinged by a pinger. How to stop unknown pinger?
My Heroku app was actually being pinged by a pinger. I freed the app from the pinger by changing the app name. Isn't it bad that anyone can add an app to a pinger and the publisher has to change the app name?

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!

Azure SignalR not working on few types of phone

I am developing a Xamarin Forms app for Android where in i need to receive events from server using Azure SignalR function. This is working fine in few phones, however on few I get strange errors.
Redmi 4 running Android 7.1 I see that the connection is successful, it it does not receive any messages.
Redmi 1s running Android 4.4 KitKat, it gets connected and I can receive messages, however soon it gets disconnected stating that remote party closed the websocket connection without completing the close handshake or 30000 ms elapsed without receiving a message from server
BTW I have a background Service where I am creating this SignalR Hub and connecting so that even if my app goes to sleep, I can still receive the server events.
it works fine on some of the other newer phones in my home. so my question is what is the best way to debug these kind of issues. I don't see any logs in the Device Log that can help me understand what is going on.

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.

Windows does not answer BLE parameter update request

I have a custom embedded device with a Bluetooth low energy stack. The device is advertising itself until a connection is requested, I pair and connect to it via the Bluetooth menu in Windows 10, I can read/write to my custom GATT services using the following BLE GATT functions from the Win32 API.
For my application I need to receive high frequency data using notifications on a characteristic so I enable it using the same API as stated above and receive the correct data but too slow. The default connection parameters Windows is using is not enough and I want to update them so I can receive notification events at higher frequency, but Windows API does not provide such function. I had the same problem when connection to an Android phone, and I solved it by requesting connection parameters update from the device (the slave in the connection) and the Android phone accepted it and everything worked as expected.
The only problem is when I'm trying to ask for a connection parameter update from the device when connected to a Windows master, I don't receive any response (no accept nor reject), meanwhile I still receive notification events so I know the connection is still active. And the weird thing is that if I hold the device closer to the computer's Bluetooth antenna it does receive a response and update the connection parameters like intended.
Any idea what's going on? Is it a bug in Windows stack?
The fact that holding device closer to antenna helps should be verified. Try it multiple times in a different way.
You mentioned Android, does holding device further from Android also prevent connection parameters update?
If this proves true, I'd say the device is faulty. I would compare the behavior between different devices, better if they are from different manufacturers or at least models.

Resources