diff options
author | Divy Srivastava <dj.srivastava23@gmail.com> | 2023-04-20 21:54:22 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-20 21:54:22 +0530 |
commit | 1976504c632c78aaadbf24dc94e8ce5626bce9f1 (patch) | |
tree | fea14670fb1811e27e647370d810645aa1987cfe /ext/websocket/01_websocket.js | |
parent | f5202840818cade33c65c0ae6c2ac17fb5732229 (diff) |
refactor(ext/websocket): use fastwebsockets client (#18725)
Diffstat (limited to 'ext/websocket/01_websocket.js')
-rw-r--r-- | ext/websocket/01_websocket.js | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/ext/websocket/01_websocket.js b/ext/websocket/01_websocket.js index 2c6bf46b2..60378b675 100644 --- a/ext/websocket/01_websocket.js +++ b/ext/websocket/01_websocket.js @@ -317,9 +317,7 @@ class WebSocket extends EventTarget { this[_bufferedAmount] += byteLength; PromisePrototypeThen( core.opAsync2( - this[_role] === SERVER - ? "op_server_ws_send_binary" - : "op_ws_send_binary", + "op_ws_send_binary", this[_rid], view, ), @@ -357,7 +355,7 @@ class WebSocket extends EventTarget { this[_bufferedAmount] += TypedArrayPrototypeGetByteLength(d); PromisePrototypeThen( core.opAsync2( - this[_role] === SERVER ? "op_server_ws_send_text" : "op_ws_send_text", + "op_ws_send_text", this[_rid], string, ), @@ -416,7 +414,7 @@ class WebSocket extends EventTarget { PromisePrototypeCatch( core.opAsync( - this[_role] === SERVER ? "op_server_ws_close" : "op_ws_close", + "op_ws_close", this[_rid], code, reason, @@ -441,7 +439,7 @@ class WebSocket extends EventTarget { async [_eventLoop]() { while (this[_readyState] !== CLOSED) { const { 0: kind, 1: value } = await core.opAsync2( - this[_role] === SERVER ? "op_server_ws_next_event" : "op_ws_next_event", + "op_ws_next_event", this[_rid], ); @@ -508,7 +506,7 @@ class WebSocket extends EventTarget { if (prevState === OPEN) { try { await core.opAsync( - this[_role] === SERVER ? "op_server_ws_close" : "op_ws_close", + "op_ws_close", this[_rid], code, value, @@ -537,7 +535,7 @@ class WebSocket extends EventTarget { this[_idleTimeoutTimeout] = setTimeout(async () => { if (this[_readyState] === OPEN) { await core.opAsync( - this[_role] === SERVER ? "op_server_ws_send" : "op_ws_send", + "op_ws_send", this[_rid], { kind: "ping", @@ -548,7 +546,7 @@ class WebSocket extends EventTarget { this[_readyState] = CLOSING; const reason = "No response from ping frame."; await core.opAsync( - this[_role] === SERVER ? "op_server_ws_close" : "op_ws_close", + "op_ws_close", this[_rid], 1001, reason, |