Socket.IO: Move pingInterval and reconnectAttempts to config
This commit is contained in:
parent
caff06ab95
commit
c62d42de80
@ -48,9 +48,8 @@ namespace ASC.Socket.IO.Svc
|
||||
[Singletone]
|
||||
public class SocketServiceLauncher : IHostedService
|
||||
{
|
||||
private const int PingInterval = 10000;
|
||||
private const int ReconnectAttempts = 5;
|
||||
|
||||
private int PingInterval { get; set; }
|
||||
private int ReconnectAttempts { get; set; }
|
||||
private Process Proc { get; set; }
|
||||
private ProcessStartInfo StartInfo { get; set; }
|
||||
private SocketIO SocketClient { get; set; }
|
||||
@ -84,6 +83,9 @@ namespace ASC.Socket.IO.Svc
|
||||
try
|
||||
{
|
||||
var settings = ConfigurationExtension.GetSetting<SocketSettings>("socket");
|
||||
|
||||
PingInterval = settings.PingInterval.GetValueOrDefault(10000);
|
||||
ReconnectAttempts = settings.ReconnectAttempts.GetValueOrDefault(5);
|
||||
|
||||
StartInfo = new ProcessStartInfo
|
||||
{
|
||||
|
@ -6,5 +6,8 @@
|
||||
public string Port { get; set; }
|
||||
public string RedisHost { get; set; }
|
||||
public string RedisPort { get; set; }
|
||||
public int? PingInterval { get; set; }
|
||||
public int? ReconnectAttempts { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -3,6 +3,8 @@
|
||||
"path": "../../ASC.Socket.IO",
|
||||
"port": "9899",
|
||||
"redisHost": "",
|
||||
"redisPort": 6379
|
||||
"redisPort": 6379,
|
||||
"pingInterval": 60000,
|
||||
"reconnectAttempts": 3
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user