diff --git a/CoreAgent.API/Configurations/websocket.Development.json b/CoreAgent.API/Configurations/websocket.Development.json
index 64b4f7a..d9c1ae4 100644
--- a/CoreAgent.API/Configurations/websocket.Development.json
+++ b/CoreAgent.API/Configurations/websocket.Development.json
@@ -4,8 +4,14 @@
"TimeoutMs": 15000,
"BatchTimeoutMs": 50,
"MaxBatchSize": 50,
+ "EnableAutoReconnect": true,
"MaxReconnectAttempts": 3,
"QueueCapacity": 500,
- "CacheTtlMinutes": 5
+ "SendChannelCapacity": 500,
+ "ReceiveChannelCapacity": 500,
+ "PriorityChannelCapacity": 50,
+ "CacheTtlMinutes": 5,
+ "MaxChunkSize": 32768,
+ "ChunkDelayMs": 1
}
}
\ No newline at end of file
diff --git a/CoreAgent.API/Configurations/websocket.json b/CoreAgent.API/Configurations/websocket.json
index 3f3662a..e0c67eb 100644
--- a/CoreAgent.API/Configurations/websocket.json
+++ b/CoreAgent.API/Configurations/websocket.json
@@ -4,8 +4,14 @@
"TimeoutMs": 30000,
"BatchTimeoutMs": 100,
"MaxBatchSize": 100,
+ "EnableAutoReconnect": true,
"MaxReconnectAttempts": 5,
"QueueCapacity": 10000,
- "CacheTtlMinutes": 30
+ "SendChannelCapacity": 1000,
+ "ReceiveChannelCapacity": 1000,
+ "PriorityChannelCapacity": 100,
+ "CacheTtlMinutes": 30,
+ "MaxChunkSize": 65536,
+ "ChunkDelayMs": 1
}
}
\ No newline at end of file
diff --git a/CoreAgent.Infrastructure/Services/Network/CellularNetworkService.cs b/CoreAgent.Infrastructure/Services/Network/CellularNetworkService.cs
index ac43610..31e2920 100644
--- a/CoreAgent.Infrastructure/Services/Network/CellularNetworkService.cs
+++ b/CoreAgent.Infrastructure/Services/Network/CellularNetworkService.cs
@@ -157,7 +157,7 @@ public class CellularNetworkService : ICellularNetworkService
if (!isRanQuit)
{
_logger.LogWarning("RAN 退出状态检查失败");
- return CellularNetworkOperationResult.Failure("RAN 退出状态检查失败");
+ //return CellularNetworkOperationResult.Failure("RAN 退出状态检查失败");
}
}
diff --git a/CoreAgent.WebSocketTransport/Extensions/WebSocketTransportExtensions.cs b/CoreAgent.WebSocketTransport/Extensions/WebSocketTransportExtensions.cs
index 6d19886..df6c240 100644
--- a/CoreAgent.WebSocketTransport/Extensions/WebSocketTransportExtensions.cs
+++ b/CoreAgent.WebSocketTransport/Extensions/WebSocketTransportExtensions.cs
@@ -81,9 +81,9 @@ namespace CoreAgent.WebSocketTransport.Extensions
return new MessageChannelManager(
logger,
- config.QueueCapacity,
- config.QueueCapacity,
- 100);
+ config.SendChannelCapacity,
+ config.ReceiveChannelCapacity,
+ config.PriorityChannelCapacity);
});
// 注册 WebSocket 传输
diff --git a/CoreAgent.WebSocketTransport/Interfaces/IMessageChannelManager.cs b/CoreAgent.WebSocketTransport/Interfaces/IMessageChannelManager.cs
index efddc8f..048bd29 100644
--- a/CoreAgent.WebSocketTransport/Interfaces/IMessageChannelManager.cs
+++ b/CoreAgent.WebSocketTransport/Interfaces/IMessageChannelManager.cs
@@ -30,14 +30,26 @@ public interface IMessageChannelManager : IDisposable
ChannelStatusInfo GetStatusInfo();
///
- /// 清空所有通道
+ /// 创建所有通道(如果已存在则跳过)
+ ///
+ void CreateChannels();
+
+ ///
+ /// 清空所有通道中的消息(保持通道可用)
///
void ClearAllChannels();
///
- /// 完成所有通道
+ /// 完成所有通道(标记不再接受新消息,但保持可读)
///
void CompleteAllChannels();
+
+ ///
+ /// 释放所有通道(完全释放资源)
+ ///
+ void ReleaseChannels();
+
+
}
///
diff --git a/CoreAgent.WebSocketTransport/Models/WebSocketConfig.cs b/CoreAgent.WebSocketTransport/Models/WebSocketConfig.cs
index 78baf87..aa10843 100644
--- a/CoreAgent.WebSocketTransport/Models/WebSocketConfig.cs
+++ b/CoreAgent.WebSocketTransport/Models/WebSocketConfig.cs
@@ -33,6 +33,11 @@ public class WebSocketConfig
[Range(1, 10000, ErrorMessage = "最大批量大小必须在 1-10000 之间")]
public int MaxBatchSize { get; set; } = 100;
+ ///
+ /// 是否启用自动重连功能
+ ///
+ public bool EnableAutoReconnect { get; set; } = true;
+
///
/// 最大重连尝试次数
///
@@ -40,11 +45,29 @@ public class WebSocketConfig
public int MaxReconnectAttempts { get; set; } = 5;
///
- /// 队列容量
+ /// 队列容量(已废弃,请使用 SendChannelCapacity、ReceiveChannelCapacity、PriorityChannelCapacity)
///
[Range(10, 100000, ErrorMessage = "队列容量必须在 10-100000 之间")]
public int QueueCapacity { get; set; } = 10000;
+ ///
+ /// 发送通道容量
+ ///
+ [Range(10, 100000, ErrorMessage = "发送通道容量必须在 10-100000 之间")]
+ public int SendChannelCapacity { get; set; } = 1000;
+
+ ///
+ /// 接收通道容量
+ ///
+ [Range(10, 100000, ErrorMessage = "接收通道容量必须在 10-100000 之间")]
+ public int ReceiveChannelCapacity { get; set; } = 1000;
+
+ ///
+ /// 优先级通道容量
+ ///
+ [Range(10, 10000, ErrorMessage = "优先级通道容量必须在 10-10000 之间")]
+ public int PriorityChannelCapacity { get; set; } = 100;
+
///
/// 缓存消息 TTL(分钟)
///
diff --git a/CoreAgent.WebSocketTransport/Services/MessageChannelManager.cs b/CoreAgent.WebSocketTransport/Services/MessageChannelManager.cs
index b9f57f3..39d815e 100644
--- a/CoreAgent.WebSocketTransport/Services/MessageChannelManager.cs
+++ b/CoreAgent.WebSocketTransport/Services/MessageChannelManager.cs
@@ -14,9 +14,17 @@ public class MessageChannelManager : IMessageChannelManager
private volatile bool _disposed;
private readonly object _disposeLock = new object();
- public IMessageChannel SendChannel { get; }
- public IMessageChannel