Asp.net:
SignalR API , API . , SignalR API , .
. , , . SignalR . API , SignalR , . API , SignalR , . , , SignalR keepalive , API .
, SignalR 2.1 keep-alives . , - HTTP-. disable keepalive, keepalive null. keepalive disabled .
Self-Host, 3 :
GlobalHost.Configuration.ConnectionTimeout = new TimeSpan(0,0,110);
GlobalHost.Configuration.DisconnectTimeout = new TimeSpan(0,0,30);
GlobalHost.Configuration.KeepAlive = new TimeSpan(0,0,10);
"" , Ping:
public class MyHub : Hub
{
public void Ping()
{
}
}
, Ping :
var proxy = $.connection.myHub,
intervalHandle;
...
$.connection.hub.disconnected(function() {
clearInterval(intervalHandle);
});
...
$.connection.hub.start().done(function() {
if($.connection.hub.transport.name === "longPolling") {
intervalHandle = setInterval(function() {
if($.connection.hub.state === $.signalR.connectionState.connected) {
proxy.server.ping().fail(function() {
TryAndRestartConnection();
});
}
}, 10000);
}
});
.