0
votes

I am using SignalR Self Hosted Service(V 2.2.0) as server and using Silverlight as SignalR Client.

I am able to connect to the server and able to exchange the messages. I am having a button to stop connection to the SignalR service.

What I want is, When I click this button, Connection of that Client should get disconnected from SignalR Hub. I am able to get disconnected from SignalR Hub but it takes so much time to respond and my Client(Silverlight Web Application) gets into unresponsive state and comes back after around 28-30 secs. Is there any way to disconnect client immediately once the button is clicked?

2
do you call Stop method in your silverlight client? msdn.microsoft.com/en-us/library/…Nikola.Lukovic

2 Answers

2
votes

This is because of a deadlock. SignalR client blocks the thread when sending the Abort request. However Silverlight wants to send the request on the UI thread. The default timeout for stopping the connection is 30 seconds so after the timeout the thread is unblocked and execution continues. This can be worked around by invoking stop asynchronously (await Task.Factory.StartNew(() => hubConnection.Stop());) or making the timeout smaller.

TL;DR;

https://github.com/SignalR/SignalR/issues/3102

0
votes

I resolved my problem by calling hub disconnect method in Silverlight Threading task. So now I do not worry about acknowledgement of hub disconnect from SignalR.