fix: websocket prototype

This commit is contained in:
Percs 2024-11-26 17:03:18 -06:00
parent 51f1a773a4
commit 58fed66f78
5 changed files with 221 additions and 222 deletions

View file

@ -21,7 +21,7 @@ export default function (client: ScramjetClient, self: typeof globalThis) {
client.Proxy("WebSocket", {
construct(ctx) {
const fakeWebSocket = new EventTarget() as WebSocket;
Object.setPrototypeOf(fakeWebSocket, self.WebSocket.prototype);
Object.setPrototypeOf(fakeWebSocket, ctx.fn.prototype);
fakeWebSocket.constructor = ctx.fn;
const trustEvent = (ev: Event) =>