Repository navigation
docs: add WebSocket ready-state documentation - #2309
Merged
Merged
Conversation
Adds connection-state constants and an example for checking them. Related: grafana/k6#6306
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.
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. |
Contributor
There was a problem hiding this comment.
I dont know if I would mention the enum here... It never worked & could confuse people
Contributor
Author
There was a problem hiding this comment.
Feel free to send your commits to this PR π
Keep connection-state guidance focused on the supported constants.
janHildebrandt98
approved these changes
Sep 15, 2026
inancgumus
marked this pull request as ready for review
September 16, 2026 21:35
inancgumus
requested review from
AgnesToulet and
ankur22
and removed request for
a team
September 16, 2026 21:35
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
npm startcommand locally and verified that the changes look good.docs/sources/k6/nextfolder of the documentation.Related PR(s)/Issue(s)