mirror of
https://github.com/XTLS/Xray-core.git
synced 2024-11-14 20:53:18 +00:00
Browser Dialer: Revert changes to event listeners (#3906)
https://github.com/XTLS/Xray-core/issues/3882#issuecomment-2396167708 This does not fix the linked issue, just a random bug I found.
This commit is contained in:
parent
5164a82185
commit
8c180b9cfd
|
@ -24,7 +24,10 @@
|
||||||
// arraybuffer is significantly faster in chrome than default
|
// arraybuffer is significantly faster in chrome than default
|
||||||
// blob, tested with chrome 123
|
// blob, tested with chrome 123
|
||||||
ws.binaryType = "arraybuffer";
|
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;
|
clientIdleCount -= 1;
|
||||||
let [method, url, protocol] = event.data.split(" ");
|
let [method, url, protocol] = event.data.split(" ");
|
||||||
switch (method) {
|
switch (method) {
|
||||||
|
@ -134,10 +137,10 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
check();
|
check();
|
||||||
});
|
};
|
||||||
ws.addEventListener("error", (event) => {
|
ws.onerror = function (event) {
|
||||||
ws.close();
|
ws.close();
|
||||||
});
|
};
|
||||||
};
|
};
|
||||||
let checkTask = setInterval(check, 1000);
|
let checkTask = setInterval(check, 1000);
|
||||||
</script>
|
</script>
|
||||||
|
|
Loading…
Reference in a new issue