2013-03-05 30 views

回答

3

您可以綁定到斷開連接的事件。

所以集線器添加方法:

public override Task OnDisconnected() 
{ 
    // The Context.ConnectionId is the identity of the disconnected client 
    return Clients.All.userOffline(/* Something here to identify the user */); 
}