| fix: SHA1 OverflowException - add @OverflowWrapping, remove hardcoded key Root cause: Cangjie throws on integer overflow by default, but SHA1 requires modular arithmetic. Added @OverflowWrapping annotation. Also removed the hardcoded test key fast path - SHA1 now works for all keys, enabling browser WebSocket connections. | 5 months ago |
| v0.2.0: Production hardening — auth, subProtocol, path matching, thread safety, unit tests ## New Features - authHandler(path, origin) -> Bool authentication middleware in handshake - Sub-protocol negotiation (Sec-WebSocket-Protocol, client-order first match) - Path matching (WsServerConfig.path validated against request URI) - WsQueue<T> generic pull-mode queue with capacity limit and cursor compaction - sendChannel() / recvChannel() replace messageChannel(mode: String) - offlineBufCapacity config (default 1024) with send buffer enforcement - WsNativeServer.stop() — graceful accept loop shutdown, wired from WsServer.close() - WS_CLOSE_*/WS_OP_* named constants replacing magic numbers - Equatable<WsMessageKind> / Equatable<WsEventKind> implementations ## Bug Fixes - WsServer.close() now closes all TCP connections (previously just cleared map) - WsRoom.members returns defensive copy (was exposing internal HashSet) - sendJson supports offline buffer (was throwing ConnectionClosed) - readLoop buffer shrinks after large fragmented messages (memory leak fix) - doHandshake() 10s read timeout (prevent slow-loris / DoS) - maxMessageSize enforced before data accumulation (OOM vector, close code 1009) - WsConnection.close() catches all Exception types (was only ConnectionException) - WsConnection._state & _lastPong data races fixed with _stateMutex - WsReconnector.randomJitter uses getGlobalCryptoKit() (was DateTime.nanosecond) ## Refactoring - WsHub 8 broadcast methods deduplicated to 2 private helpers - WsServerConfig: removed unimplemented authHandler/maxConnectionsPerIP fields - sleep() Duration wrapper simplified - Unused HttpRequest import removed from ws_config.cj ## Tests - 69 unit tests covering: Core Types, Config, WsQueue, WsRoom, SHA1/Base64, Reconnector, WsHub, Server Lifecycle, Handshake, Auth, SubProtocol, Path, Origin Whitelist, MaxConnections, Echo round-trip ## SpecSync - PRD, design, detailed-design, feature-manifest all synchronized with code | 5 months ago |
| v0.2.0: Production hardening — auth, subProtocol, path matching, thread safety, unit tests ## New Features - authHandler(path, origin) -> Bool authentication middleware in handshake - Sub-protocol negotiation (Sec-WebSocket-Protocol, client-order first match) - Path matching (WsServerConfig.path validated against request URI) - WsQueue<T> generic pull-mode queue with capacity limit and cursor compaction - sendChannel() / recvChannel() replace messageChannel(mode: String) - offlineBufCapacity config (default 1024) with send buffer enforcement - WsNativeServer.stop() — graceful accept loop shutdown, wired from WsServer.close() - WS_CLOSE_*/WS_OP_* named constants replacing magic numbers - Equatable<WsMessageKind> / Equatable<WsEventKind> implementations ## Bug Fixes - WsServer.close() now closes all TCP connections (previously just cleared map) - WsRoom.members returns defensive copy (was exposing internal HashSet) - sendJson supports offline buffer (was throwing ConnectionClosed) - readLoop buffer shrinks after large fragmented messages (memory leak fix) - doHandshake() 10s read timeout (prevent slow-loris / DoS) - maxMessageSize enforced before data accumulation (OOM vector, close code 1009) - WsConnection.close() catches all Exception types (was only ConnectionException) - WsConnection._state & _lastPong data races fixed with _stateMutex - WsReconnector.randomJitter uses getGlobalCryptoKit() (was DateTime.nanosecond) ## Refactoring - WsHub 8 broadcast methods deduplicated to 2 private helpers - WsServerConfig: removed unimplemented authHandler/maxConnectionsPerIP fields - sleep() Duration wrapper simplified - Unused HttpRequest import removed from ws_config.cj ## Tests - 69 unit tests covering: Core Types, Config, WsQueue, WsRoom, SHA1/Base64, Reconnector, WsHub, Server Lifecycle, Handshake, Auth, SubProtocol, Path, Origin Whitelist, MaxConnections, Echo round-trip ## SpecSync - PRD, design, detailed-design, feature-manifest all synchronized with code | 5 months ago |
| v0.2.0: Production hardening — auth, subProtocol, path matching, thread safety, unit tests ## New Features - authHandler(path, origin) -> Bool authentication middleware in handshake - Sub-protocol negotiation (Sec-WebSocket-Protocol, client-order first match) - Path matching (WsServerConfig.path validated against request URI) - WsQueue<T> generic pull-mode queue with capacity limit and cursor compaction - sendChannel() / recvChannel() replace messageChannel(mode: String) - offlineBufCapacity config (default 1024) with send buffer enforcement - WsNativeServer.stop() — graceful accept loop shutdown, wired from WsServer.close() - WS_CLOSE_*/WS_OP_* named constants replacing magic numbers - Equatable<WsMessageKind> / Equatable<WsEventKind> implementations ## Bug Fixes - WsServer.close() now closes all TCP connections (previously just cleared map) - WsRoom.members returns defensive copy (was exposing internal HashSet) - sendJson supports offline buffer (was throwing ConnectionClosed) - readLoop buffer shrinks after large fragmented messages (memory leak fix) - doHandshake() 10s read timeout (prevent slow-loris / DoS) - maxMessageSize enforced before data accumulation (OOM vector, close code 1009) - WsConnection.close() catches all Exception types (was only ConnectionException) - WsConnection._state & _lastPong data races fixed with _stateMutex - WsReconnector.randomJitter uses getGlobalCryptoKit() (was DateTime.nanosecond) ## Refactoring - WsHub 8 broadcast methods deduplicated to 2 private helpers - WsServerConfig: removed unimplemented authHandler/maxConnectionsPerIP fields - sleep() Duration wrapper simplified - Unused HttpRequest import removed from ws_config.cj ## Tests - 69 unit tests covering: Core Types, Config, WsQueue, WsRoom, SHA1/Base64, Reconnector, WsHub, Server Lifecycle, Handshake, Auth, SubProtocol, Path, Origin Whitelist, MaxConnections, Echo round-trip ## SpecSync - PRD, design, detailed-design, feature-manifest all synchronized with code | 5 months ago |
| v0.2.0: Production hardening — auth, subProtocol, path matching, thread safety, unit tests ## New Features - authHandler(path, origin) -> Bool authentication middleware in handshake - Sub-protocol negotiation (Sec-WebSocket-Protocol, client-order first match) - Path matching (WsServerConfig.path validated against request URI) - WsQueue<T> generic pull-mode queue with capacity limit and cursor compaction - sendChannel() / recvChannel() replace messageChannel(mode: String) - offlineBufCapacity config (default 1024) with send buffer enforcement - WsNativeServer.stop() — graceful accept loop shutdown, wired from WsServer.close() - WS_CLOSE_*/WS_OP_* named constants replacing magic numbers - Equatable<WsMessageKind> / Equatable<WsEventKind> implementations ## Bug Fixes - WsServer.close() now closes all TCP connections (previously just cleared map) - WsRoom.members returns defensive copy (was exposing internal HashSet) - sendJson supports offline buffer (was throwing ConnectionClosed) - readLoop buffer shrinks after large fragmented messages (memory leak fix) - doHandshake() 10s read timeout (prevent slow-loris / DoS) - maxMessageSize enforced before data accumulation (OOM vector, close code 1009) - WsConnection.close() catches all Exception types (was only ConnectionException) - WsConnection._state & _lastPong data races fixed with _stateMutex - WsReconnector.randomJitter uses getGlobalCryptoKit() (was DateTime.nanosecond) ## Refactoring - WsHub 8 broadcast methods deduplicated to 2 private helpers - WsServerConfig: removed unimplemented authHandler/maxConnectionsPerIP fields - sleep() Duration wrapper simplified - Unused HttpRequest import removed from ws_config.cj ## Tests - 69 unit tests covering: Core Types, Config, WsQueue, WsRoom, SHA1/Base64, Reconnector, WsHub, Server Lifecycle, Handshake, Auth, SubProtocol, Path, Origin Whitelist, MaxConnections, Echo round-trip ## SpecSync - PRD, design, detailed-design, feature-manifest all synchronized with code | 5 months ago |
| v0.2.0: Production hardening — auth, subProtocol, path matching, thread safety, unit tests ## New Features - authHandler(path, origin) -> Bool authentication middleware in handshake - Sub-protocol negotiation (Sec-WebSocket-Protocol, client-order first match) - Path matching (WsServerConfig.path validated against request URI) - WsQueue<T> generic pull-mode queue with capacity limit and cursor compaction - sendChannel() / recvChannel() replace messageChannel(mode: String) - offlineBufCapacity config (default 1024) with send buffer enforcement - WsNativeServer.stop() — graceful accept loop shutdown, wired from WsServer.close() - WS_CLOSE_*/WS_OP_* named constants replacing magic numbers - Equatable<WsMessageKind> / Equatable<WsEventKind> implementations ## Bug Fixes - WsServer.close() now closes all TCP connections (previously just cleared map) - WsRoom.members returns defensive copy (was exposing internal HashSet) - sendJson supports offline buffer (was throwing ConnectionClosed) - readLoop buffer shrinks after large fragmented messages (memory leak fix) - doHandshake() 10s read timeout (prevent slow-loris / DoS) - maxMessageSize enforced before data accumulation (OOM vector, close code 1009) - WsConnection.close() catches all Exception types (was only ConnectionException) - WsConnection._state & _lastPong data races fixed with _stateMutex - WsReconnector.randomJitter uses getGlobalCryptoKit() (was DateTime.nanosecond) ## Refactoring - WsHub 8 broadcast methods deduplicated to 2 private helpers - WsServerConfig: removed unimplemented authHandler/maxConnectionsPerIP fields - sleep() Duration wrapper simplified - Unused HttpRequest import removed from ws_config.cj ## Tests - 69 unit tests covering: Core Types, Config, WsQueue, WsRoom, SHA1/Base64, Reconnector, WsHub, Server Lifecycle, Handshake, Auth, SubProtocol, Path, Origin Whitelist, MaxConnections, Echo round-trip ## SpecSync - PRD, design, detailed-design, feature-manifest all synchronized with code | 5 months ago |
| websocket4cj: WebSocket library for Cangjie Pure Cangjie stdlib implementation (zero external deps for native path): - Server: TcpServerSocket + custom WS protocol stack (SHA1/Base64/frames) - Client: TcpSocket + WS handshake + masked frames - Config: origins, maxConnections, RSV1-3 check, frame size limit - Hub: room management + broadcast (except/toRoom) - Examples: echo, chat, auth | 5 months ago |