allow websockets in dedicated workers

This commit is contained in:
Percs 2024-08-31 14:06:02 -05:00
parent 70e0a684ae
commit 3b9017e464
8 changed files with 42 additions and 21 deletions

View file

@ -1,17 +1,10 @@
import { iswindow, isworker } from "../..";
import { ScramjetClient } from "../../client";
import { BareClient } from "../../../shared";
const bare = iswindow && new BareClient();
export default function (client: ScramjetClient, self: typeof globalThis) {
// r58 please fix
if (isworker) return;
client.Proxy("WebSocket", {
construct(ctx) {
ctx.return(
bare.createWebSocket(
client.bare.createWebSocket(
ctx.args[0],
ctx.args[1],
ctx.fn as typeof WebSocket,