uWebSockets

Simple, secure & standards compliant web server for the most demanding of applications

APACHE-2.0 License

Downloads
13
Stars
16.9K
Committers
45

Bot releases are visible (Hide)

uWebSockets - v20.3.0

Published by about 3 years ago

Dedicated decompressors

Adds uWS::CompressOptions::DEDICATED_DECOMPRESSOR. This (decompressor) flag can be OR:ed with one (compressor) flag to easily create a complete compression preference such as:

.compression = uWS::CompressOptions(uWS::DEDICATED_COMPRESSOR_4KB | uWS::DEDICATED_DECOMPRESSOR),

See https://github.com/uNetworking/uWebSockets/issues/1347. This change is backwards compatible. More specific decompressors will be added with time.

uWebSockets - v20.2.0

Published by about 3 years ago

  • Moves TopicTree from individual WebSocketContextData's up to the one shared App.
  • Fixes undefined behavior in the destructor of App (passes fuzzing build sanity checks).
  • Fixes two fuzzing issues introduced in v20 (fuzzing should now be clean; but let's wait a week and find out).
uWebSockets - v20.1.0

Published by about 3 years ago

Adds wider TopicTree fuzz testing and fixes first v20 bug.

uWebSockets - v20.0.0

Published by about 3 years ago

Massively simplified & improved pub/sub

Pub/sub is now a lot more predictable and always guarantees strict ordering inside topics, across topics and between WebSocket::send and WebSocket::publish / App::publish. Subscription and unsubscription is always guaranteed to be strictly ordered with respect to publish. Support for MQTT wildcards has been removed.

Backwards compatible

Unless you're relying on MQTT wildcards ('#', '+'), v20.0.0 is entirely backwards compatible with v19.9.0.

Motivation

When pub/sub was introduced in 2018, it was designed based on a few assumptions:

  • SHARED_COMPRESSOR being preferred by customers and customers being okay with supporting many application-level messages wrapped in and delivered as one bigger WebSocket message.
    • Expectation: Customers being willing to optimize the application protocol to minimize compression overhead.
    • Reality: This is way too complicated for customers and not even backwards compatible with their existing protocols. Customers simply want things to work, and they heavily prefer DEDICATED_COMPRESSOR.
  • Subscription and unsubscription to/from topics being "malleable" and not strictly ordered.
    • Expectation: Customers being fine with subscriptions and unsubscriptions being executed in as big of a batch as possible, with minor re-ordering of messages not being a problem.
    • Reality: Many apps depend on a strict ordering guarantee and break down if order is not guaranteed. This is why the nonStrict hack was added, which performs really bad in worst-case and is badly understood.
  • WebSocket::send and WebSocket::publish being two different streams out of order with each other.
    • Expectation: There being a separate use for pub/sub, not related to send.
    • Reality: Customers expect WebSocket::publish followed by WebSocket::send to be delivered in order, and the opposite likewise.
  • MQTT syntax being useful
    • Expectation: Efficient use of a logarithmic tree of topics and wildcards
    • Reality: Customers don't care
uWebSockets - v19.9.0

Published by about 3 years ago

Fixes a bug applicable to the new publish-to-all-except-self feature in v19 (WebSocket::publish).

uWebSockets - v19.8.0

Published by about 3 years ago

Large messages & slow receivers

WebSockets are typically used for small message sending. In some cases you might end up with larger-than-ideal messages being sent, and these cases need to be handled efficiently. Especially if receivers are slow and backpressure is building up.

  • Only reduce backpressure in steps of 1/32th of the backpressure itself. This hinders excessive reallocation/shifting of especially large backpressure and improves drainage performance.

  • Use std::string::erase instead of std::string::substr. This alone is a 3x performance improvement for worst cases.

  • Write directly to backpressure if sending a large message, or if already draining. This improves sending performance of large messages as we avoid extra copying/allocations.

  • Adds ability to benchmark large message echoing with load_test. Use extra argument size_mb. This release is at least 1.5x the peformance when echoing 100mb messages.

uWebSockets - v18.24.0

Published by about 3 years ago

uWebSockets - v19.6.0

Published by about 3 years ago

Reordering fix

v19.0.0a1 introduced a bug that broke the publishing ordering guarantees across topics.

uWebSockets - v19.5.0

Published by about 3 years ago

Boost Asio

Adding support for seamless integration with Boost Asio.

Compile with WITH_ASIO=1 and integrate with existing boost::asio::io_context on the same thread.

Caveat: Loop must be run by uWS (Loop::run() or us_loop_run) even if the io_context is third party.

uWebSockets - v19.4.0

Published by about 3 years ago

Stampede tweaks

  • Tweaks the TLS handshake queue to better cope with mass connections and mass disconnections.
  • Adjusts the WebSocket shutdown timeout from a default of 120 seconds to roughly 4 seconds, making mass disconnections finish quicker.

Please report any issues or undesired side effects introduced in this release.

uWebSockets - v19.3.0

Published by over 3 years ago

Do not publish to self

  • Fixes a bug where publishing to all but self, still would publish to self (WebSocket::publish).
  • Adds test case for this issue.
  • Improves scale_test.
  • Fixes header install.
  • Fixes 4 GB HTTP stream limit on 32-bit platforms.
uWebSockets - v19.2.0

Published by over 3 years ago

idleTimeout fix

  • Fixes bad (broken) ping timeout calculations for idleTimeout = 16, 32, 64, ...
uWebSockets - v19.1.0

Published by over 3 years ago

First fixes

  • Fixes compilation of WebSocket::isSubscribed, App::numSubscribers
  • WebSocket::iterateTopics returns topic names without initial slash ("/broadcast" is now returned as "broadcast").
uWebSockets - v19.0.0

Published by over 3 years ago

All versions below v19 are now deprecated. This is as usual - we only manage one branch and therefore it is important to upgrade. No fixes will be backported to deprecated versions. Don't worry - v19 is mostly backwards compatible with v18 except for a few key areas:

1. Ping and pong events now take std::string_view message [definitely breaking]

Any WebSocket ping or pong frame can carry a small message as payload. We never exposed that message to the library user until now. This means we break APIs a tiny bit. Look at the (updated) examples to see what I mean.

2. WebSocket::getUserData is now type safe [most probably backwards compatible]

The type of WebSocket<SSL, isServer> has changed to WebSocket<SSL, isServer, USERDATA> where USERDATA is what you specified in App::ws<USERDATA>, often times called PerSocketData. This was done to make WebSocket::getUserData() type safe instead of returning a void pointer. This change should be entirely backwards compatible for everyone using type inference (all examples do).

3. WebSocket::publish now sends to every subscriber except for itself [differing behavior]

Publishing using WebSocket::publish will now send to all subscribers in the whole App, except for to itself. If you want to send to all subscribers in the App, unconditionally, use App::publish. This change is potentially breaking, so check your usage - however - most users were expecting this behavior so this change will most likely fix things rather than break things.

4. Pings are now sent automatically if necessary to meet idleTimeout constraints [differing behavior]

Defaults regarding ping/pong have changed. Now the server will automatically send pings as needed, unless the client has sent us something recently. This is a change from v18 where all clients had the sole responsibility of sending the server something every once in a while to not time out. Yes, you can revert back to the old behavior via settings, but the new default is for the server to manage pings automatically - meaning that the entire heartbeat problematic is now entirely automatic by default - you don't need to consider it, it just works.

5. WebSocket::unsubscribeAll was removed [definitely breaking]

v19 adds new functions regarding pub/sub - such as WebSocket::iterateTopics. This means the rather specialized WebSocket::unsubscribeAll makes less sense now. Especially since the library automatically unsubscribes from all topics on socket close (more efficiently). So this function was removed in favor of more general functions.

uWebSockets - v19.0.0 alpha 5

Published by over 3 years ago

Fuzzing fixes and API changes

Fuzzing is now without issues at roughly 97% coverage - higher than ever reported before. Some API changes - still some to be done.

uWebSockets - v19.0.0 alpha 4

Published by over 3 years ago

Updated uSockets

  • Updates to uSockets v0.7.1 with many fixes, new features and strict stress tests passing nicely.
uWebSockets - v19.0.0 alpha 3

Published by over 3 years ago

Non-strict subscribe/unsubscribe

  • WebSocket::subscribe and unsubscribe now takes bool nonStrict as a very significant optimization in certain use cases.
  • idleTimeout must be specified as 0 or greater than 8 and is now unsigned short, limiting maximum timeout as 18 hours (2^16 seconds).
  • Timeouts are now truncated to nearest 4 second and a warning is displayed for timeouts not being a multiple of 4.
  • Timeouts have been micro optimized and will require up to 40% less CPU-time overall (although 40% of nothing is nothing!).
uWebSockets - v19.0.0 alpha 2

Published by over 3 years ago

Automatic ping/pong management

Adds new option "sendPingsAutomatically" and changes a few defaults to more sane values in respect to simplicity. With these defaults you no longer have to bother with timeouts or pings but can put all focus on business logic.

uWebSockets - v19.0.0 alpha 1

Published by over 3 years ago

Publish to all subscribers except sender

One of the most requested features since pub/sub was added. WebSocket::publish will no longer publish to itself, even if subscribed to the topic being published to. App::publish remains like before and will publish to any matching subscriber.

uWebSockets - v18.23.0

Published by over 3 years ago

Slight timeout tweaks & fix

Adds a new option resetIdleTimeoutOnSend, set to true by default for backwards compatibility with old behavior. You can set this to false in case you only want data receives to reset idleTimeout for your WebSockets (which is probably the most sane value).

The Linux kernel defaults to a TCP retransmission timeout of 15 minutes, meaning that with resetIdleTimeoutOnSend not set to false can postpone the detection of broken sockets by, well 15 minutes. This can be way too long if your idleTimeout is somewhere around 120 seconds.

TLDR; If your idleTimeout is quite short and you have a stable stream of data flowing to the server, you probably want to set resetIdleTimeoutOnSend = false.

This release also fixes a timeout bug in drain event of WebSockets