summaryrefslogtreecommitdiff
path: root/ext/websocket/02_websocketstream.js
diff options
context:
space:
mode:
Diffstat (limited to 'ext/websocket/02_websocketstream.js')
-rw-r--r--ext/websocket/02_websocketstream.js20
1 files changed, 7 insertions, 13 deletions
diff --git a/ext/websocket/02_websocketstream.js b/ext/websocket/02_websocketstream.js
index f545d7a99..8e7100cdb 100644
--- a/ext/websocket/02_websocketstream.js
+++ b/ext/websocket/02_websocketstream.js
@@ -236,7 +236,7 @@ class WebSocketStream {
},
});
const pull = async (controller) => {
- const { 0: kind, 1: value } = await core.opAsync(
+ const { 0: kind, 1: value } = await core.opAsync2(
"op_ws_next_event",
this[_rid],
);
@@ -249,7 +249,11 @@ class WebSocketStream {
controller.enqueue(value);
break;
}
- case 5: {
+ case 2: {
+ /* pong */
+ break;
+ }
+ case 3: {
/* error */
const err = new Error(value);
this[_closed].reject(err);
@@ -257,17 +261,7 @@ class WebSocketStream {
core.tryClose(this[_rid]);
break;
}
- case 3: {
- /* ping */
- await core.opAsync("op_ws_send_pong", this[_rid]);
- await pull(controller);
- break;
- }
- case 2: {
- /* pong */
- break;
- }
- case 6: {
+ case 4: {
/* closed */
this[_closed].resolve(undefined);
core.tryClose(this[_rid]);