Skip to content

Commit

Permalink
Browser Dialer: Revert changes to event listeners (XTLS#3906)
Browse files Browse the repository at this point in the history
XTLS#3882 (comment)

This does not fix the linked issue, just a random bug I found.
  • Loading branch information
mmmray authored and leninalive committed Oct 29, 2024
1 parent fec291f commit 998c35f
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions transport/internet/browser_dialer/dialer.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@
// arraybuffer is significantly faster in chrome than default
// blob, tested with chrome 123
ws.binaryType = "arraybuffer";
ws.addEventListener("message", (event) => {
// note: this event listener is later overwritten after the
// handshake has completed. do not attempt to modernize it without
// double-checking that this continues to work
ws.onmessage = function (event) {
clientIdleCount -= 1;
let [method, url, protocol] = event.data.split(" ");
switch (method) {
Expand Down Expand Up @@ -134,10 +137,10 @@
};

check();
});
ws.addEventListener("error", (event) => {
};
ws.onerror = function (event) {
ws.close();
});
};
};
let checkTask = setInterval(check, 1000);
</script>
Expand Down

0 comments on commit 998c35f

Please sign in to comment.