mirror of
https://github.com/denoland/deno.git
synced 2025-09-27 12:49:10 +00:00
fix(runtime/websocket): respond to ping with pong (#8974)
This commit is contained in:
parent
c823211a2c
commit
f85cd54cb4
2 changed files with 15 additions and 3 deletions
|
@ -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;
|
||||
|
@ -265,6 +267,13 @@
|
|||
event.target = this;
|
||||
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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue