Skip to content

Fix WebSocket.send fast call compilation for Node.js v24+#1243

Closed
Copilot wants to merge 3 commits intomasterfrom
copilot/debug-7c1272e-running-issues
Closed

Fix WebSocket.send fast call compilation for Node.js v24+#1243
Copilot wants to merge 3 commits intomasterfrom
copilot/debug-7c1272e-running-issues

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 14, 2026

V8 removed FastApiTypedArray<T> and FastApiCallbackOptions::fallback in Node.js v24, breaking compilation of the uWS_WebSocket_send_fast path for ABI 137 (v24) and 141 (v25).

Changes

  • src/WebSocketWrapper.h
    • Add #include "node_version.h" (already present in the -I targets/node-VERSION/include/node path set by build.c)
    • Guard uWS_WebSocket_send_fast and its CFunction::Make registration behind #if NODE_MODULE_VERSION <= 127 (v22 and earlier retain FastApiTypedArray)
    • For v24+, fall back to a plain FunctionTemplate::New without the fast-call hint
#if NODE_MODULE_VERSION <= 127
    // Fast path: JIT-callable directly; only available on Node ≤ v22
    template <bool SSL>
    static uint32_t uWS_WebSocket_send_fast(v8::Local<v8::Object> receiver,
        const v8::FastApiTypedArray<uint8_t>& message,
        bool isBinary, bool compress, v8::FastApiCallbackOptions& options) { ... }
#endif

// In init():
#if NODE_MODULE_VERSION <= 127
    static v8::CFunction fast_send = v8::CFunction::Make(uWS_WebSocket_send_fast<SSL>);
    wsTemplateLocal->PrototypeTemplate()->Set(..., FunctionTemplate::New(isolate,
        uWS_WebSocket_send<SSL>, ..., &fast_send));
#else
    wsTemplateLocal->PrototypeTemplate()->Set(..., FunctionTemplate::New(isolate,
        uWS_WebSocket_send<SSL>));
#endif

Version mapping for reference: NODE_MODULE_VERSION 115 = v20, 127 = v22, 137 = v24, 141 = v25.


📍 Connect Copilot coding agent with Jira, Azure Boards or Linear to delegate work to Copilot in one click without leaving your project management tool.

…ol on Linux and LNK2019 on Windows for Node.js v25 (ABI 141)

Co-authored-by: uNetworkingAB <110806833+uNetworkingAB@users.noreply.github.com>
Copilot AI changed the title [WIP] Debug running issues introduced by 7c1272e Fix undefined symbol for CFunctionInfo constructor in Node.js v25 (ABI 141) Mar 14, 2026
Copilot AI requested a review from uNetworkingAB March 14, 2026 22:16
…removed

Co-authored-by: uNetworkingAB <110806833+uNetworkingAB@users.noreply.github.com>
Copilot AI changed the title Fix undefined symbol for CFunctionInfo constructor in Node.js v25 (ABI 141) Fix WebSocket.send fast call compilation for Node.js v24+ Mar 14, 2026
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