This value tells you how a user disconnected, if its set to true then the user explicitly closed the connection, otherwise they timed out.
It's worth noting that at while in these functions you still have access to the Context, therefore you can get the connectionId and identify who/what has disconnected.
Remember, a user can have **more then one connectionId **, so think about how you want to store all the connection IDs for one user
Example of informing others in a group that a user has disconnected
No need to worry about connection in signalr.
If you want to notify other clients/users throughout the application ,you not need to worry about the connection because signalr new connection is created every time you visit other pages in the web app.
we can leverage the users feature of signalr to achieve the same. see the example below:
//Hub Example of SignalR
public class NotificationHub : Hub
When ever a user connects to your hub, the OnConnected() is called. You can over ride this function and implement your own logic if you need to keep track of or limit the number of connections
Overloading the disconnect function allows you to handle what to do when a user disconnects.
This modified text is an extract of the original Stack Overflow Documentation created by following contributors and released under CC BY-SA 3.0