源文件名全部改为蛇形命名,public 类型名与 import 路径不变;README 目录结构同步更新;版本升级 1.2.0

This commit is contained in:
2026-08-25 12:03:46 +08:00
parent bcaf3d76a2
commit cbfa3fcbdc
9 changed files with 13 additions and 8 deletions
+7 -7
View File
@@ -40,15 +40,15 @@ import simcu::websocket.common.WebSocketMessage
src/ src/
├── websocket.cj # 模块锚点 ├── websocket.cj # 模块锚点
├── common/ ├── common/
│ ├── WsTypes.cj # WebSocketMessage / ReadyState / WebSocketException / CloseCodes / WsEvents │ ├── ws_types.cj # WebSocketMessage / ReadyState / WebSocketException / CloseCodes / WsEvents
│ └── FrameStream.cj # RFC 6455 帧层(握手工具、掩码、分片重组、maxPayload) │ └── frame_stream.cj # RFC 6455 帧层(握手工具、掩码、分片重组、maxPayload)
├── client/ ├── client/
│ └── WebSocketClient.cj # 客户端 │ └── websocket_client.cj # 客户端
├── server/ ├── server/
│ ├── IWebsocketHandler.cj # 服务端 handler 接口(onConnect/onMessage/onClose/onError │ ├── i_websocket_handler.cj # 服务端 handler 接口(onConnect/onMessage/onClose/onError
│ ├── WebSocketServer.cj # 监听 / 握手 / 按路径路由 / 广播 / 组存储 │ ├── websocket_server.cj # 监听 / 握手 / 按路径路由 / 广播 / 组存储
│ ├── WebSocketSenders.cj # 链式门面(组管理 + 组播/单播发送的实现) │ ├── websocket_senders.cj # 链式门面(组管理 + 组播/单播发送的实现)
│ └── WebSocketConnection.cj # 服务端单条连接 │ └── websocket_connection.cj # 服务端单条连接
└── tests/ └── tests/
└── websocket_test.cj # 端到端集成测试 └── websocket_test.cj # 端到端集成测试
``` ```
+1 -1
View File
@@ -3,7 +3,7 @@ cjc-version = "1.1.3"
name = "websocket" name = "websocket"
organization = "simcu" organization = "simcu"
description = "SimApi WebSocket 库(RFC 6455):事件回调式客户端与接口式服务端。客户端 connect/send(三重重载)/ping/close/terminate + onOpen/onMessage/onError/onClose;服务端 WebSocketServer(port) + addHandler(path, factory) 按路径路由、每连接独立 handler,链式门面 group(name)/conn(connId) 支持组管理/组播/单播/广播,连接断开自动清组" description = "SimApi WebSocket 库(RFC 6455):事件回调式客户端与接口式服务端。客户端 connect/send(三重重载)/ping/close/terminate + onOpen/onMessage/onError/onClose;服务端 WebSocketServer(port) + addHandler(path, factory) 按路径路由、每连接独立 handler,链式门面 group(name)/conn(connId) 支持组管理/组播/单播/广播,连接断开自动清组"
version = "1.1.0" version = "1.2.0"
target-dir = "" target-dir = ""
output-type = "static" output-type = "static"
@@ -64,6 +64,11 @@ public class WebSocketServer {
s.bind() s.bind()
serverSock = Some(s) serverSock = Some(s)
running = true running = true
var paths = ""
for (p in pathFactories.keys()) {
paths = if (paths.isEmpty()) { p } else { "${paths}, ${p}" }
}
println("[websocket] 已监听 端口=${localPort} 端点=[${paths}]")
spawn { => acceptLoop() } spawn { => acceptLoop() }
} }