-
Notifications
You must be signed in to change notification settings - Fork 587
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
implement WebSocketStream #2713
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2713 +/- ##
==========================================
- Coverage 93.64% 91.63% -2.01%
==========================================
Files 86 90 +4
Lines 23862 24897 +1035
==========================================
+ Hits 22345 22815 +470
- Misses 1517 2082 +565 ☔ View full report in Codecov by Sentry. |
@nodejs/undici this is ready to review now, although this should not be merged until WebSocketStream is added into the spec. whatwg/websockets#48 |
@KhafraDev I don't have so much opinion on this one. I'm not interested in the Web API stuff. Which is why I'd like to separate them out more from undici core. If you can get one more approving review it should be mergeable. @mcollina |
Maybe we could start pinging the web standards team for reviews? |
// 12. Let writable be a new WritableStream . | ||
// 13. Set up writable with writeAlgorithm , closeAlgorithm , and abortAlgorithm . | ||
const writable = new WritableStream({ | ||
write: (chunk) => this.#write(chunk), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this is respecting backpressure.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
WritableStream should have backpressure built into it, at least according to mdn https://developer.mozilla.org/en-US/docs/Web/API/WritableStream
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, but you are not forwarding the information of the underlining socket being busy up.
https://github.com/nodejs/undici/pull/2713/files#diff-c1287dec52a96e140d7231c268bfa35a6f1e0390c46ccaf15b3ba5834f2a7342R322 will return false
if the socket is "full", and then emit a 'drain'
event when free again. This is not connected in any way to the WritableStream
.
lib/websocket/symbols.js
Outdated
@@ -8,5 +8,6 @@ module.exports = { | |||
kBinaryType: Symbol('binary type'), | |||
kSentClose: Symbol('sent close'), | |||
kReceivedClose: Symbol('received close'), | |||
kByteParser: Symbol('byte parser') | |||
kByteParser: Symbol('byte parser'), | |||
kPromises: Symbol('kPromises') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
keep the style?
kPromises: Symbol('kPromises') | |
kPromises: Symbol('promises') |
ae7a600
to
1abf223
Compare
enumerable implement some more implement close finish open run WPTs update wpts and fix 9/19 failures fix most remaining failures fix remaining test failures fix writing fix: implement writing completely fixup fixup
1abf223
to
13187d0
Compare
https://whatpr.org/websockets/48/7b748d3...7b81f79.html#the-websocketstream-interface
Now that the spec has been written, it's time to add it.