Skip to content

response.atomic how does it work, when should we use it? #222

Closed Answered by kartikk221
mikevercoelen asked this question in Q&A
Discussion options

You must be logged in to vote

Hello, the Response.atomic method is simply an alias of the uWS.HttpResponse.cork() method.

From what I understand, the purpose of this method is to let uWebsockets.js know that you intend to perform multiple Network operations such as write HTTP status, headers, body chunks etc etc in the Response. It is essentially a way to optimize and I think even required in the recent updates when doing async work so uWebsockets.js can batch these network write operations as much as possible especially for SSL.

HyperExpress automatically makes use of corking / this method internally wherever needed so you don't have to actually worry about using this method in any way unless you are doing something …

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by kartikk221
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants