FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Add _corkUnsafe and _uncorkUnsafe to WebSocket and HttpResponse wrappers by Copilot · Pull Request #1244 · uNetworking/uWebSockets.js · GitHub

Add _corkUnsafe and _uncorkUnsafe to WebSocket and HttpResponse wrappers - #1244

Draft
uNetworkingAB with Copilot wants to merge 3 commits into
masterfrom
copilot/add-uncork-cork-functions
Draft

Add _corkUnsafe and _uncorkUnsafe to WebSocket and HttpResponse wrappers#1244
uNetworkingAB with Copilot wants to merge 3 commits into
masterfrom
copilot/add-uncork-cork-functions

Conversation

Copilot AI commented Mar 15, 2026
edited
Loading

Copy link
Copy Markdown
Contributor

Exposes direct cork/uncork on the underlying AsyncSocket for both WebSocket and HttpResponse, bypassing the safe callback-based cork() API for advanced use cases requiring manual cork state management.

Changes

  • AsyncSocketCorkHelper<bool SSL> — thin helper struct inheriting uWS::AsyncSocket<SSL> to expose the protected cork() and uncork() methods; guarded with #ifndef UWS_JS_ASYNC_SOCKET_CORK_HELPER_DEFINED to prevent ODR violations when both wrapper headers are compiled in the same TU
  • WebSocketWrapper — adds uWS_WebSocket_corkUnsafe / uWS_WebSocket_uncorkUnsafe, registered as _corkUnsafe / _uncorkUnsafe
  • HttpResponseWrapper — adds res_corkUnsafe / res_uncorkUnsafe, registered in the if constexpr (SSL != 2) block (same scope as cork; excludes QUIC/CACHE); uses SSL != 0 to map int PROTOCOL → bool SSL for the cast
  • docs/index.d.ts — adds typed declarations for both interfaces with warnings about mandatory pairing

Usage

// Manual cork/uncork without callback overhead
ws._corkUnsafe();
ws.send(data1);
ws.send(data2);
ws._uncorkUnsafe();

res._corkUnsafe();
res.writeStatus('200 OK').writeHeader('Content-Type', 'text/plain').end('hello');
res._uncorkUnsafe();

⚠️ _corkUnsafe must always be paired with _uncorkUnsafe. Failing to uncork leaves the socket in a permanently corked state and prevents data from being flushed.


📱 Kick off Copilot coding agent tasks wherever you are with GitHub Mobile, available on iOS and Android.

…eWrapper

Co-authored-by: uNetworkingAB <110806833+uNetworkingAB@users.noreply.github.com>
Copilot AI changed the title [WIP] Add uncorkUnsafe and corkUnsafe functions for wrappers Add _corkUnsafe and _uncorkUnsafe to WebSocket and HttpResponse wrappers Mar 15, 2026
Copilot AI requested a review from uNetworkingAB March 15, 2026 10:52

ronag left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Add fast api

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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.

3 participants


Back | FazBrowse Home | New Git URL