diff options
Diffstat (limited to 'runtime/js')
-rw-r--r-- | runtime/js/27_websocket.js | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/runtime/js/27_websocket.js b/runtime/js/27_websocket.js index 60428c24d..9f86bdbed 100644 --- a/runtime/js/27_websocket.js +++ b/runtime/js/27_websocket.js @@ -167,6 +167,7 @@ this.#bufferedAmount += ta.size; core.jsonOpAsync("op_ws_send", { rid: this.#rid, + kind: "binary", }, ta).then(() => { this.#bufferedAmount -= ta.size; }); @@ -193,6 +194,7 @@ this.#bufferedAmount += d.size; core.jsonOpAsync("op_ws_send", { rid: this.#rid, + kind: "text", text: string, }).then(() => { this.#bufferedAmount -= d.size; @@ -266,6 +268,13 @@ this.dispatchEvent(event); this.#eventLoop(); + } else if (message.type === "ping") { + core.jsonOpAsync("op_ws_send", { + rid: this.#rid, + kind: "pong", + }); + + this.#eventLoop(); } else if (message.type === "close") { this.#readyState = CLOSED; const event = new CloseEvent("close", { |