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]
|
[Singletone]
|
||||||
public class SocketServiceLauncher : IHostedService
|
public class SocketServiceLauncher : IHostedService
|
||||||
{
|
{
|
||||||
private const int PingInterval = 10000;
|
private int PingInterval { get; set; }
|
||||||
private const int ReconnectAttempts = 5;
|
private int ReconnectAttempts { get; set; }
|
||||||
|
|
||||||
private Process Proc { get; set; }
|
private Process Proc { get; set; }
|
||||||
private ProcessStartInfo StartInfo { get; set; }
|
private ProcessStartInfo StartInfo { get; set; }
|
||||||
private SocketIO SocketClient { get; set; }
|
private SocketIO SocketClient { get; set; }
|
||||||
@ -85,6 +84,9 @@ namespace ASC.Socket.IO.Svc
|
|||||||
{
|
{
|
||||||
var settings = ConfigurationExtension.GetSetting<SocketSettings>("socket");
|
var settings = ConfigurationExtension.GetSetting<SocketSettings>("socket");
|
||||||
|
|
||||||
|
PingInterval = settings.PingInterval.GetValueOrDefault(10000);
|
||||||
|
ReconnectAttempts = settings.ReconnectAttempts.GetValueOrDefault(5);
|
||||||
|
|
||||||
StartInfo = new ProcessStartInfo
|
StartInfo = new ProcessStartInfo
|
||||||
{
|
{
|
||||||
CreateNoWindow = false,
|
CreateNoWindow = false,
|
||||||
|
@ -6,5 +6,8 @@
|
|||||||
public string Port { get; set; }
|
public string Port { get; set; }
|
||||||
public string RedisHost { get; set; }
|
public string RedisHost { get; set; }
|
||||||
public string RedisPort { 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",
|
"path": "../../ASC.Socket.IO",
|
||||||
"port": "9899",
|
"port": "9899",
|
||||||
"redisHost": "",
|
"redisHost": "",
|
||||||
"redisPort": 6379
|
"redisPort": 6379,
|
||||||
|
"pingInterval": 60000,
|
||||||
|
"reconnectAttempts": 3
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user