Last Updated: February 25, 2016
· playerx

Be careful about OnDisconnected when using SignalR

If you are using SignalR for your real-time communication, be careful about OnDisconnected virtual method, because there are two different implementations.

1 - It is fired only when connection was closed gracefully (not every time!):

public virtual Task OnDisconnected()

2 - It is fired every time when connection closes:

public virtual Task OnDisconnected(bool stopCalled)

So I recommend to use second version.