services.AddSignalR(hubOptions =>
{
//服务器端向客户端 ping的间隔
//hubOptions.KeepAliveInterval = TimeSpan.FromSeconds(15);
//60s没收到客户端心跳信息,断开连接
hubOptions.ClientTimeoutInterval = TimeSpan.FromSeconds(15);
});
这样设置后调试的时候没有收到客户端心跳信息服务端不会主动断开连接。
看了源码,原来只有生产模式才会触发这种机制,有点坑。。。