Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Explore uWebSockets as a ws alternative #16579

Open
4 tasks done
privatenumber opened this issue May 2, 2024 · 2 comments
Open
4 tasks done

Explore uWebSockets as a ws alternative #16579

privatenumber opened this issue May 2, 2024 · 2 comments

Comments

@privatenumber
Copy link
Contributor

Description

I learned about https://github.com/uNetworking/uWebSockets.js which is a faster alternative to ws.

Bun uses a fork of it for WebSockets, and based on these HTTP server benchmarks, uWebSockets.js via Node is actually faster than bun.

More benchmarks: uNetworking/uWebSockets#1415

I'm not sure how much of a bottleneck ws is, but it may be worth exploring.

Suggested solution

Explore adopting uWebSockets.js

Alternative

No response

Additional context

No response

Validations

@sapphi-red
Copy link
Member

I checked uWebSockets.js and I think it has the following problems to be used in Vite:

  • lack of minor platform support: it only supports Tier 1 platforms and there aren't any fallback implementations like we have with esbuild
  • does not have a builtin way to only install the binary needed for the platform it is ran in (e.g. optionalDependencies)

Even if these problems were solved, it has a big package size even for a single platform (5MB; ws is 143kB), so it would need to improve the perf significantly to make it worth.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants