summaryrefslogtreecommitdiff
path: root/ext/websocket/01_websocket.js
diff options
context:
space:
mode:
Diffstat (limited to 'ext/websocket/01_websocket.js')
-rw-r--r--ext/websocket/01_websocket.js16
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,