-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Add ability to specify the masking key #1989
Conversation
There are two issues with this
|
7b2c4e6
to
f48ab82
Compare
Another possible alternative, which might be simpler, could be a const ws = new WebSocket(url, {
randomMask(mask) {
// Do nothing.
}
}) It would not have a per message granularity, but I think it is not required. |
I think copying should also be fine. It’s 4 bytes. |
This is a good idea, I would not want to require adding mask details to all my ws.send() calls individually, a const ws = new WebSocket(url, {
maskBuffer: buf => require('crypto').randomFillSync(buf) // default function
})
const ws = new WebSocket(url, {
maskBuffer: buf => buf.writeUInt32BE(Math.random()*2**32) // Math.random example
})
const ws = new WebSocket(url, {
maskBuffer: Buffer.alloc(4) // clear mask example
})
|
I’m good with either option. |
FYI @alexhultman added clear mask checking on already optimized uWS server uNetworking/uWebSockets@0c8be4d and is reporting 10% performance improvement for large messages which is pretty good so it's ready and compatible with this PR, and you will probably see better improvement for this Node client which currently does crypto and bit xor |
See #1990. |
Closing in favor of #1990. |
Refs: #1986
Refs: #1988