-
Notifications
You must be signed in to change notification settings - Fork 30.5k
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
net: make readyState to be closed if socket is not opened #38249
Conversation
doc/api/net.md
Outdated
@@ -1125,6 +1129,8 @@ This property represents the state of the connection as a string. | |||
* If the stream is readable and writable, it is `open`. | |||
* If the stream is readable and not writable, it is `readOnly`. | |||
* If the stream is not readable and writable, it is `writeOnly`. | |||
* If the stream is not opened or is neither readable nor writable, it is |
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.
Perhaps we should avoid using words like 'open' here because it's an actual readyState
value and might be confusing?
Perhaps something like:
* If the stream is not opened or is neither readable nor writable, it is | |
* If the stream is not connecting, connected, or is otherwise neither readable nor writable, it is |
doc/api/net.md
Outdated
@@ -1125,6 +1129,8 @@ This property represents the state of the connection as a string. | |||
* If the stream is readable and writable, it is `open`. |
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.
It might be nice to change stream
here to socket
here and elsewhere in this property's description as it makes more sense IMO.
@lpinca how is it with websockets? |
Co-authored-by: Brian White <mscdex@mscdex.net>
|
I think it would also be okay to document the current state of things. |
If I understand correctly, it won't be able to land in current major version (v16 I assume), should we note the current state in the document in the first place? If so, I could open a new PR to amend the document. |
hi, for this pr, I have a question for why the readyState change from closed to open in node@v14.x ? |
This would need a rebase if we still want to land it. |
This issue/PR was marked as stalled, it will be automatically closed in 30 days. If it should remain open, please leave a comment explaining why it should remain open. |
Closing this because it has stalled. Feel free to reopen if this issue/PR is still relevant, or to ping the collaborator who labelled it stalled if you have any questions. |
This PR sets
Socket.readyState
toclosed
, when socket is not opened (stillpending
but notconnecting
).Currently,
Socket.readyState
isopen
before socket is connected to a peer. It can be somehow confusing for users.Fixes: #38247