mirror of
https://github.com/MercuryWorkshop/scramjet.git
synced 2025-05-17 08:00:02 -04:00
allow websockets in dedicated workers
This commit is contained in:
parent
70e0a684ae
commit
3b9017e464
8 changed files with 42 additions and 21 deletions
|
@ -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,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue