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

extending ws to support 48bit values #1973

Merged
merged 2 commits into from Nov 16, 2021
Merged

Conversation

prettydiff
Copy link
Contributor

The ws library is using 32 bit values on the read and write for payload length. This is because web sockets supports 63 bit payload lengths if the payload flag is 127 but JavaScript's max number is 53 bits - 1.

Node.js supports a 48 bit read and write operation. The maximum payload length supported by 32 bits is 2.1gb. The maximum payload length supported by 48 bits is 281tb.

Is there test automation or CI I can run this against?

lib/receiver.js Outdated Show resolved Hide resolved
lib/sender.js Show resolved Hide resolved
@lpinca lpinca merged commit 4916d03 into websockets:master Nov 16, 2021
@lpinca
Copy link
Member

lpinca commented Nov 16, 2021

Thank you.

@lpinca
Copy link
Member

lpinca commented Nov 16, 2021

FWIW, the largest size allowed for a Buffer is 2^32, so right now, even with this change, it is not possible to write frames with more than 2^32 bytes of data.

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

Successfully merging this pull request may close these issues.

None yet

2 participants