Fixed the problem of traffic statistics api url
This commit is contained in:
@@ -8,9 +8,9 @@ namespace ServiceLib.Services.Statistics
|
||||
private Config _config;
|
||||
private bool _exitFlag;
|
||||
private ClientWebSocket? webSocket;
|
||||
private string url = string.Empty;
|
||||
private Action<ServerSpeedItem>? _updateFunc;
|
||||
|
||||
private string Url => $"ws://{Global.Loopback}:{AppHandler.Instance.StatePort2}/traffic";
|
||||
|
||||
public StatisticsSingboxService(Config config, Action<ServerSpeedItem> updateFunc)
|
||||
{
|
||||
_config = config;
|
||||
@@ -26,12 +26,10 @@ namespace ServiceLib.Services.Statistics
|
||||
|
||||
try
|
||||
{
|
||||
url = $"ws://{Global.Loopback}:{AppHandler.Instance.StatePort2}/traffic";
|
||||
|
||||
if (webSocket == null)
|
||||
{
|
||||
webSocket = new ClientWebSocket();
|
||||
await webSocket.ConnectAsync(new Uri(url), CancellationToken.None);
|
||||
await webSocket.ConnectAsync(new Uri(Url), CancellationToken.None);
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
|
||||
Reference in New Issue
Block a user