scramjet/src/client/requests/websocket.ts
2024-07-21 15:17:31 -04:00

23 lines
425 B
TypeScript

import { client } from "..";
import { BareClient } from "../shared";
if ("window" in self) {
const bare = new BareClient();
client.Proxy("WebSocket", {
construct(ctx) {
ctx.return(
bare.createWebSocket(
ctx.args[0],
ctx.args[1],
ctx.fn as typeof WebSocket,
{
"User-Agent": navigator.userAgent,
Origin: client.url.origin,
},
ArrayBuffer.prototype
)
);
},
});
}