diff options
author | crowlKats <13135287+crowlKats@users.noreply.github.com> | 2021-01-05 13:37:02 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-05 13:37:02 +0100 |
commit | f85cd54cb4a1c54d835374d83dba4f8f7b89d2d1 (patch) | |
tree | a9f1d28b6b34014972ed36c1666d069bcca1c95e /runtime/js | |
parent | c823211a2cae13ff6fdb7d3d3fc585bb4e096232 (diff) |
fix(runtime/websocket): respond to ping with pong (#8974)
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", { |