Skip to content

doc: fix socket.readyState state descriptions#64468

Open
samuel871211 wants to merge 1 commit into
nodejs:mainfrom
samuel871211:doc-fix-socket-readystate
Open

doc: fix socket.readyState state descriptions#64468
samuel871211 wants to merge 1 commit into
nodejs:mainfrom
samuel871211:doc-fix-socket-readystate

Conversation

@samuel871211

@samuel871211 samuel871211 commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

lib/net.js

ObjectDefineProperty(Socket.prototype, 'readyState', {
  __proto__: null,
  get: function() {
    if (this.connecting) {
      return 'opening';
    } else if (this.readable && this.writable) {
      return 'open';
    } else if (this.readable && !this.writable) {
      return 'readOnly';
    } else if (!this.readable && this.writable) {
      return 'writeOnly';
    }
    return 'closed';
  },
});

Signed-off-by: yusheng <samuel871211@gmail.com>
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/net

@nodejs-github-bot nodejs-github-bot added doc Issues and PRs related to the documentations. net Issues and PRs related to the net subsystem. labels Jul 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

doc Issues and PRs related to the documentations. net Issues and PRs related to the net subsystem.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants