Skip to content

uws examples are misleading #5

Open
@bompus

Description

@bompus

While using uws yields some good performance benefits, trying to actually use it results in some issues.

The first issue I came across, is a fairly important one. Trying to add response headers in both Express and Koa do nothing. All that comes back is the Content-length header, nothing else.

const http = require("uws").http;
// const http = require("http");

Koa:
ctx.set("Cache-Control", "no-cache");
ctx.body = "Hello World";

Express:
res.set("Cache-Control", "no-cache");
res.send("Hello World");

If you use the native http require, it works just fine. Because of this behavior, I don't think you can do a simple 1:1 comparison and have uws claim victory, when it's doing less work.

Perhaps I am doing something wrong, so please check for yourself and let me know if you see any way around this. I know that from digging around, the author of Total.js was going to try uws as well, but I believe realized it had this same issue ( https://blog.totaljs.com/blogs/news/20170530-new-total-js-framework-version-2-6/ - A support for another HTTP module )

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions