Skip to content

feat: add compat.websocket 12.0.1 (IXWebSocket RFC 6455 client, zero deps) - #158

Merged
Sunrisepeak merged 1 commit into
mcpplibs:mainfrom
FarnaHerry:feat/compat-websocket
Aug 5, 2026
Merged

feat: add compat.websocket 12.0.1 (IXWebSocket RFC 6455 client, zero deps)#158
Sunrisepeak merged 1 commit into
mcpplibs:mainfrom
FarnaHerry:feat/compat-websocket

Conversation

@FarnaHerry

Copy link
Copy Markdown
Contributor

Summary

Add compat.websocket 12.0.1IXWebSocket, a pure C++ RFC 6455 WebSocket client, as a header-compat (Form B) package with zero external dependencies.

  • Descriptor: pkgs/c/compat.websocket.lualanguage="c++23", import_std=false; the 32 client TUs transcribe upstream CMake's IXWEBSOCKET_SOURCES minus the four server TUs (IXWebSocketServer / IXSocketServer / IXHttpServer / IXWebSocketProxyServer); none of the retained TUs reference any of them, so the link is clean.
  • Zero deps by construction: TLS off (no IXWEBSOCKET_USE_TLS; OpenSSL/MbedTLS/AppleSSL TUs not built), zlib off (IXWEBSOCKET_USE_ZLIB unset; gzip codec compiles to a no-op). No features are offered yet — the server side and wss are deliberately out of scope for the first version.
  • Mirror: plain-string GLOBAL url (no mcpp-res write access here), per docs/cn-mirror.md fallback. A maintainer can flip to { GLOBAL, CN } — sha d23bdc91… is stable.
  • Test (tests/examples/websocket): fully offline and self-contained — it runs its own minimal RFC 6455 echo server on loopback raw sockets (own SHA-1 + base64 for Sec-WebSocket-Accept, own frame codec) and drives ix::WebSocket against it, asserting the handshake, client masking, text/binary echo, ping/pong both directions, fragmentation reassembly, and the close handshake.

Verification

Ran with the CI-pinned mcpp 2026.8.3.3, gcc@16.1.0, MCPP_INDEX_MIRROR=GLOBAL, MCPP_BUILD_CACHE=local, cold target//.mcpp/:

mcpp xpkg parse pkgs/c/compat.websocket.lua   →  parse OK (3 platforms / 12.0.1 / c++23 / 32 sources)
mcpp test -p websocket                        →  test result ok. 1 passed; 0 failed

11 assertions all green (ALL WEBSOCKET ASSERTIONS PASSED), including the handshake accept validation, the masked-bit check, and a fragmented-message reassembly. All lint scripts pass (syntax, required fields, no leading-v, check_mirror_urls, check_package_name, cross-package refs).

See .agents/docs/2026-08-06-add-websocket-plan.md for the full shape decision, platform flags, and the two test pitfalls found and fixed (IXWebSocket's automatic-reconnection default, and the early masked-bit assertion).

Follow-ups (not in this PR)

  • CN mirror on mcpp-res/websocket once write access is available.
  • A wss/TLS feature via compat.openssl / compat.mbedtls.
  • A C++23 thin wrapper header (websocket.hpp) over the client.

@Sunrisepeak
Sunrisepeak merged commit 1804459 into mcpplibs:main Aug 5, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants