Notify SignalR Server On Client Disconnected Accidentally (Disgracefully)
<p>I am setting my GlobalHost Configuration like this by following <a href="https://stackoverflow.com/a/18076329/3565879">this answer</a> to listen when the <em>client is unreachable</em>:</p>

<pre><code> GlobalHost.Configuration.ConnectionTimeout = TimeSpan.FromSeconds(50);
 GlobalHost.Configuration.DisconnectTimeout = TimeSpan.FromSeconds(30);
 GlobalHost.Configuration.KeepAlive = TimeSpan.FromSeconds(10);
</code></pre>

<p>And <em>Overriding</em> the <strong>OnDisconnected</strong>  method in my <strong>HUB Class</strong> to set the client has been disconnected</p>

<pre><code> public override Task OnDisconnected(bool stopCalled) {
       /*My code for saving the information of disconnecting*/
        return base.OnDisconnected(stopCalled);      
    }
</code></pre>

<p>I am using <strong>Xamarin for android</strong> as a client and calling the <em>Stop()</em> method by overriding the <strong>OnStop()</strong> method of my activity, like this:</p>

<pre><code>       protected override void OnStop()
        {

         //hubConnection.Stop(); previously I was using this but it takes too long to stop the hub connection in this way. so I wrote an explicit method and invoke it .

           Task hubconnection = serverHub.Invoke("StopConnection", new object[] { MethodToIdentifyDevice() }).ContinueWith(r =&gt;
            {

            });


            base.OnStop();
        }
</code></pre>

<p>Secondly, I have written an explicit hubmethod to invoke when to notify my server explicitly that my client has stopped working. That method works at OnStop event.</p>

<p>My actual problem is that what if 
All of the stuff above is not able to call <strong>OnDisconnected</strong> method on <strong>activity stop</strong> or the <strong>application closed</strong>.</p>

<p>Is there anything I am missing which is not letting it to happen.</p>

<p>UPDATE: 
I have tried changing the Transport level to WebSocket but it is not provided in Xamarin SDK for SignalR as mentioned in the intellisense .
<a href="https://i.stack.imgur.com/dwy60.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/dwy60.png" alt="enter image description here"></a></p>