Skip to content

docs: add WebSocket ready-state documentation - #2309

Merged
inancgumus merged 3 commits into
mainfrom
add/websocket-ready-state
Sep 16, 2026
Merged

inancgumus merged 3 commits into
mainfrom
add/websocket-ready-state

Conversation

@inancgumus

@inancgumus inancgumus commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

What?

Documents WebSocket connection-state constants for k6 v2.3.0.

Why?

Helps users check connection state with the same named constants they use in a browser.

Checklist

  • I have used a meaningful title for the PR.
  • I have described the changes I've made in the "What?" section above.
  • I have performed a self-review of my changes.
  • I have run the npm start command locally and verified that the changes look good.
  • I have made my changes in the docs/sources/k6/next folder of the documentation.

Related PR(s)/Issue(s)

Adds connection-state constants and an example for checking them.

Related: grafana/k6#6306
@inancgumus

Copy link
Copy Markdown
Contributor Author

@janHildebrandt98 Could you review the ready-state documentation for your change in grafana/k6#6306?

Direct users to browser-compatible constants instead of a runtime enum\nthat k6 does not export.
@github-actions

github-actions Bot commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

πŸ’» Deploy preview deleted (docs: add WebSocket ready-state documentation).

| `WebSocket.CLOSED` | `3` | The connection is closed or could not be opened. |

The constants are read-only and also available on each instance, for example, `ws.OPEN`.
Use these constants, as you would in a browser, instead of importing a `ReadyState` enum: k6 does not export a runtime enum.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I dont know if I would mention the enum here... It never worked & could confuse people

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feel free to send your commits to this PR πŸ™‡

Keep connection-state guidance focused on the supported constants.
@inancgumus
inancgumus marked this pull request as ready for review September 16, 2026 21:35
@inancgumus
inancgumus requested review from a team and heitortsergent as code owners September 16, 2026 21:35
@inancgumus
inancgumus requested review from AgnesToulet and ankur22 and removed request for a team September 16, 2026 21:35
@inancgumus
inancgumus merged commit 9e89832 into main Sep 16, 2026
19 checks passed
@inancgumus
inancgumus deleted the add/websocket-ready-state branch September 16, 2026 21:35
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.

2 participants