1- import { CookieJar } from "../../http /index.js" ;
2- import { ReadableStream } from "../streams /index.js" ;
1+ import { ReadableStream } from "../experimental/streams /index.js" ;
2+ import { CookieJar } from "../http /index.js" ;
33
44/**
5- * This module provides an experimental implementation of the WebSocket API
6- * for k6.
5+ * This module provides a WebSocket API for k6.
76 *
8- * https://grafana.com/docs/k6/latest/javascript-api/k6-experimental/ websockets/
7+ * https://grafana.com/docs/k6/latest/javascript-api/k6-websockets/
98 */
109
1110/**
@@ -43,7 +42,7 @@ export class WebSocket {
4342
4443 /**
4544 * The Websocket constructor returns a newly created WebSocket object.
46- * https://grafana.com/docs/k6/latest/javascript-api/k6-experimental/ websockets/websocket/
45+ * https://grafana.com/docs/k6/latest/javascript-api/k6-websockets/websocket/
4746 *
4847 * @param url - The URL to which to connect; this should be the URL to which the WebSocket server will respond.
4948 * @param protocols - Either a single protocol string or an array of protocol strings. The param is reserved for future use and will be presently ignored.
@@ -53,7 +52,7 @@ export class WebSocket {
5352
5453 /**
5554 * Enqueues data to be transmitted to the server over the WebSocket connection.
56- * https://grafana.com/docs/k6/latest/javascript-api/k6-experimental/ websockets/websocket/websocket-send/
55+ * https://grafana.com/docs/k6/latest/javascript-api/k6-websockets/websocket/websocket-send/
5756 *
5857 * @param data - the data to send to the server
5958 */
@@ -62,7 +61,7 @@ export class WebSocket {
6261 /**
6362 * Bind event names to event handlers to be executed when their
6463 * respective event is received by the server.
65- * https://grafana.com/docs/k6/latest/javascript-api/k6-experimental/ websockets/websocket/websocket-addeventlistener/
64+ * https://grafana.com/docs/k6/latest/javascript-api/k6-websockets/websocket/websocket-addeventlistener/
6665 *
6766 * @param event - the event to listen for
6867 * @param listener - the callback to invoke when the event is emitted
@@ -71,7 +70,7 @@ export class WebSocket {
7170
7271 /**
7372 * Closes the WebSocket connection or connection attempt, if any.
74- * https://grafana.com/docs/k6/latest/javascript-api/k6-experimental/ websockets/websocket/websocket-close/
73+ * https://grafana.com/docs/k6/latest/javascript-api/k6-websockets/websocket/websocket-close/
7574 *
7675 * @param code - An integer WebSocket connection close code value indicating a reason for closure.
7776 * @param reason - A human-readable string WebSocket connection close reason. No longer than 123 bytes of UTF-8 text.
@@ -80,47 +79,47 @@ export class WebSocket {
8079
8180 /**
8281 * Sends a ping message over the WebSocket connection.
83- * https://grafana.com/docs/k6/latest/javascript-api/k6-experimental/ websockets/websocket/websocket-ping/
82+ * https://grafana.com/docs/k6/latest/javascript-api/k6-websockets/websocket/websocket-ping/
8483 */
8584 ping ( ) : void ;
8685
8786 /**
8887 * Sets an event handler which is invoked when a message event happens.
89- * https://grafana.com/docs/k6/latest/javascript-api/k6-experimental/ websockets/websocket/websocket-onmessage/
88+ * https://grafana.com/docs/k6/latest/javascript-api/k6-websockets/websocket/websocket-onmessage/
9089 *
9190 * @param event - the message event
9291 */
9392 onmessage : ( event ?: MessageEvent ) => void ;
9493
9594 /**
9695 * Sets an event handler which is invoked when the WebSocket connection's opens.
97- * https://grafana.com/docs/k6/latest/javascript-api/k6-experimental/ websockets/websocket/websocket-onopen/
96+ * https://grafana.com/docs/k6/latest/javascript-api/k6-websockets/websocket/websocket-onopen/
9897 */
9998 onopen : ( ) => void ;
10099
101100 /**
102101 * Sets an event handler which is invoked when the WebSocket connection's closes.
103- * https://grafana.com/docs/k6/latest/javascript-api/k6-experimental/ websockets/websocket/websocket-onclose/
102+ * https://grafana.com/docs/k6/latest/javascript-api/k6-websockets/websocket/websocket-onclose/
104103 */
105104 onclose : ( ) => void ;
106105
107106 /**
108107 * Sets an event handler which is invoked when errors occur.
109- * https://grafana.com/docs/k6/latest/javascript-api/k6-experimental/ websockets/websocket/websocket-onerror/
108+ * https://grafana.com/docs/k6/latest/javascript-api/k6-websockets/websocket/websocket-onerror/
110109 *
111110 * @param event - the error event
112111 */
113112 onerror : ( event ?: ErrorEvent ) => void ;
114113
115114 /**
116115 * Sets an event handler which is invoked when a ping message is received.
117- * https://grafana.com/docs/k6/latest/javascript-api/k6-experimental/ websockets/websocket/websocket-onping/
116+ * https://grafana.com/docs/k6/latest/javascript-api/k6-websockets/websocket/websocket-onping/
118117 */
119118 onping : ( ) => void ;
120119
121120 /**
122121 * Sets an event handler which is invoked when a pong message is received.
123- * https://grafana.com/docs/k6/latest/javascript-api/k6-experimental/ websockets/websocket/websocket-onpong/
122+ * https://grafana.com/docs/k6/latest/javascript-api/k6-websockets/websocket/websocket-onpong/
124123 */
125124 onpong : ( ) => void ;
126125}
@@ -147,7 +146,7 @@ export class Blob {
147146
148147/**
149148 * k6 specific WebSocket parameters.
150- * https://grafana.com/docs/k6/latest/javascript-api/k6-experimental/ websockets/params/
149+ * https://grafana.com/docs/k6/latest/javascript-api/k6-websockets/params/
151150 */
152151export interface Params {
153152 /** Request headers. */
0 commit comments