问题描述
我有以下枢纽:
public class NotificationHub : Hub
{
public void Connect()
{
//code to add connectionId to the database goes here
Clients.Caller.OnConnected();
}
public void sendMessage(string message)
{
Clients.Caller.sendMessage(message);
}
public override Task Ondisconnected(bool b = true)
{
//code to remove connectionId from the database goes here
return base.Ondisconnected(b);
}
}
每次打开新选项卡 Connect 都会被调用,但是关闭浏览器窗口时不会调用 Ondisconnected 方法。
那么,我怎么知道未使用哪个连接ID,所以对于同一用户我不会得到很多连接ID?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)