Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SignalR dispose of HubConnection

In a AspNet SignalR client is it the action to dispose of a HubConnection necessary?

It seems to take some time, from what I have seen...

like image 287
cangosta Avatar asked Sep 17 '15 15:09

cangosta


People also ask

How long do SignalR connections stay open?

The default keepalive timeout period is currently 20 seconds. If your client code tries to call a Hub method while SignalR is in reconnecting mode, SignalR will try to send the command.

How many connections SignalR can handle?

In the default mode, the app server creates five server connections with Azure SignalR Service. The app server uses the Azure SignalR Service SDK by default. In the following performance test results, server connections are increased to 15 (or more for broadcasting and sending a message to a big group).

Does SignalR require WebSockets?

ASP.NET Core SignalR is a library that simplifies adding real-time web functionality to apps. It uses WebSockets whenever possible.

Does SignalR need SSL?

If your SignalR application transmits sensitive information between the client and server, use SSL for the transport.


1 Answers

It's not necessary if you are calling Stop().

See https://msdn.microsoft.com/en-us/library/dn235890(v=vs.118).aspx

otherwise, you should always Dispose of IDisposable objects when you are done using them.

If it is taking too long (i.e., blocking the current thread), just stop it on a Task, something like:

Task.Run(()=>hubConnection.Stop());
like image 169
d.moncada Avatar answered Sep 22 '22 09:09

d.moncada