uWebSockets

简单、安全、符合标准的 web 服务器,适用于最苛刻的应用。「Simple, secure & standards compliant web server for the most demanding of applications」

Github stars Tracking Chart


简单、安全[1] 和符合标准的[2] web 服务器,适用于最苛刻[3] 的应用。 阅读更多...

A note on speculation, lies & allegations

优化的安全性

µWebSockets 在速度和内存占用方面进行了细致的优化,它的速度足够快,即使是未加密的明文消息传递,也能比大多数替代服务器更快地完成加密的 TLS 1.3 消息传递[3]

此外,我们还参加了 Google 的 OSS-Fuzz,每天约 95% 的 fuzzing 覆盖率,没有消毒剂问题。LGTM 从零 CodeQL 警告给我们完美的 A+ 评分,我们编制了学究气的警告级别。

快速脚本化

µWebSockets 完全用 C 和 C++ 编写,但与 Node.js 后端无缝集成。这允许使用广泛的能力快速编写功能强大的应用程序的脚本。参见 µWebSockets.js

经过实践检验

自 2016 年以来,我们一直完全符合标准,并获得了完美的 Autobahn|Testsuite 评分[2]。每天都有很多公司依赖 µWebSockets --我们为 Bitfinex.com 的交易 API 提供支持,每天处理约 10 亿美元的交易量。其他公司包括 Trello,µWebSockets 正在为其 5000 万用户提供实时板块更新服务。

功能齐全

µWebSockets 是一个方便的 URL 路由器,支持通配符和参数 -- 配合受 MQTT 启发的高效的 pub/sub 功能。对于任何高要求的实时 Web 项目来说,µWebSockets 应该是一个明显的、完整的起点。

迅速开始构建您的 Http & WebSocket 应用程序;阅读用户手册查看示例。您可以浏览我们的 TypeDoc 以获得快速概述。

uWS::SSLApp({
    /* There are tons of SSL options, see uSockets */
    .cert_file_name = "cert.pem",
    .key_file_name = "key.pem"
}).get("/hello", [](auto *res, auto *req) {
    /* You can efficiently stream huge files too */
    res->writeHeader("Content-Type", "text/html; charset=utf-8")->end("Hello HTTP!");
}).ws<UserData>("/*", {
    /* Just a few of the available handlers */
    .open = [](auto *ws) {
        /* MQTT syntax */
        ws->subscribe("sensors/+/house");
    },
    .message = [](auto *ws, std::string_view message, uWS::OpCode opCode) {
        ws->send(message, opCode);
    }
}).listen(9001, [](auto *listenSocket) {
    if (listenSocket) {
        std::cout << "Listening on port " << 9001 << std::endl;
    }
}).run();

商业支持

uNetworking AB 是一家瑞典的咨询和承包公司,处理与 µWebSockets 有关的任何事情:开发、支持和客户成功。

如果您正在建设大型项目,需要咨询或有其他业务咨询,请不要犹豫,给我们发邮件。我们会找出对双方都有利的方法,并确保您不会踏入许多常见的陷阱。

特别感谢 BitMEX、Bitfinex、Google、Coinbase、Bitwyre 和 deepstreamHub 自 2016 年以来让项目本身在 GitHub 上茁壮成长 -- 没有这些华丽的公司,这个项目是不可能的。

µWebSockets 建立在 µSockets 的基础上,它是一个在三个不同层中实现事件、网络和加密的基础库。每一层都有多个实现,您可以通过标志控制编译后的组成。

简而言之

  • WITH_WOLFSSL=1 WITH_LIBUV=1 make examples 构建利用 WolfSSL 和 libuv 的示例。
  • WITH_OPENSSL=1 make examples 利用 OpenSSL 和本机内核来构建例子。

请参阅 µSockets 了解最新的标志列表和更详细的解释。

自由地授权

知识产权,保留所有权利。

在有明确声明的情况下,源代码采用 Apache License 2.0 许可,这是一个允许的 OSI 批准的许可,限制很少。修改后的 "fork" 应该只是授权的源代码,并以另一个产品名称提供。如果你对这些不确定,请在假设之前询问。


(The first version translated by vz on 2020.12.13)

Main metrics

Overview
Name With Owner4669842/ws-servers
Primary LanguageJavaScript
Program languageC++ (Language Count: 1)
PlatformBSD, Cross-platform, Linux, Mac, Windows
License:MIT License
所有者活动
Created At2018-01-18 19:52:05
Pushed At2017-06-07 20:18:32
Last Commit At2017-06-07 13:18:08
Release Count0
用户参与
Stargazers Count0
Watchers Count0
Fork Count0
Commits Count32
Has Issues Enabled
Issues Count0
Issue Open Count0
Pull Requests Count0
Pull Requests Open Count0
Pull Requests Close Count0
项目设置
Has Wiki Enabled
Is Archived
Is Fork
Is Locked
Is Mirror
Is Private

µWebSockets™ (it's "micro") is simple, secure(fuzzing) & standards compliant(https://unetworking.github.io/uWebSockets.js/report.pdf) web I/O for the most demanding(benchmarks) of applications.

User manualuSocketsFor PythonFor Node.js

© 2016-2019, >39,632,272 downloads

Express yourself briefly.

uWS::SSLApp({

    /* There are tons of SSL options */
    .cert_file_name = "cert.pem",
    .key_file_name = "key.pem"
    
}).get("/hello", [](auto *res, auto *req) {

    /* You can efficiently stream huge files too */
    res->writeHeader("Content-Type", "text/html; charset=utf-8")->end("Hello HTTP!");
    
}).ws<UserData>("/*", {

    /* Just a few of the available handlers */
    .open = [](auto *ws, auto *req) {
        ws->subscribe("buzzword weekly");
    },
    .message = [](auto *ws, std::string_view message, uWS::OpCode opCode) {
        ws->send(message, opCode);
    }
    
}).listen(9001, [](auto *token) {

    if (token) {
        std::cout << "Listening on port " << 9001 << std::endl;
    }
    
}).run();

Don't miss the user manual, the C++ examples or the JavaScript examples. JavaScript examples are very applicable to C++ developers, so go through them as well.

Pay what you want.

A free & open source (permissive) project since 2016. Kindly sponsored by BitMEX, Bitfinex & Coinbase in 2018 and/or 2019. Individual donations are always accepted via PayPal.

Code is provided as-is, do not expect or demand free consulting services, personal tutoring, advice or debugging.

Deploy like a boss.

Commercial support is available via a per-hourly consulting plan or as otherwise negotiated. If you're stuck, worried about design or just in need of help don't hesitate throwing me, the author a mail and we'll figure out what's best for both parties. I want your business to have a proper understanding of the problem before rushing in to one of the many pitfalls.

Excel across the board.

All that glitters is not gold. Especially so in a market driven by flashy logos, hype and pointless badges.

Http