@mercuryworkshop/bare-mux
Advanced tools
Comparing version 1.1.2 to 1.1.3
@@ -12,3 +12,3 @@ export type BareHeaders = Record<string, string | string[]>; | ||
ready: boolean; | ||
connect: (url: URL, origin: string, protocols: string[], requestHeaders: BareHeaders, onopen: (protocol: string) => void, onmessage: (data: Blob | ArrayBuffer | string) => void, onclose: (code: number, reason: string) => void, onerror: (error: string) => void) => (data: Blob | ArrayBuffer | string) => void; | ||
connect: (url: URL, origin: string, protocols: string[], requestHeaders: BareHeaders, onopen: (protocol: string) => void, onmessage: (data: Blob | ArrayBuffer | string) => void, onclose: (code: number, reason: string) => void, onerror: (error: string) => void) => [(data: Blob | ArrayBuffer | string) => void, (code: number, reason: string) => void]; | ||
request: (remote: URL, method: string, body: BodyInit | null, headers: BareHeaders, signal: AbortSignal | undefined) => Promise<TransferrableResponse>; | ||
@@ -15,0 +15,0 @@ meta: () => BareMeta; |
@@ -101,3 +101,3 @@ import { v4 } from 'uuid'; | ||
//@ts-expect-error not installing node types for this one thing | ||
self.BCC_VERSION = "1.1.2"; | ||
self.BCC_VERSION = "1.1.3"; | ||
console.debug("BARE_MUX_VERSION: " + self.BCC_VERSION); | ||
@@ -209,3 +209,3 @@ function initTransport(name, config) { | ||
if (!client) | ||
throw "invalid switcher"; | ||
throw "there are no bare clients"; | ||
if (!client.ready) | ||
@@ -255,3 +255,3 @@ throw new TypeError('You need to wait for the client to finish fetching the manifest before creating any WebSockets. Try caching the manifest data before making this request.'); | ||
requestHeaders['Connection'] = 'Upgrade'; | ||
const sendData = client.connect(remote, origin, protocols, requestHeaders, (protocol) => { | ||
const websocket = client.connect(remote, origin, protocols, requestHeaders, (protocol) => { | ||
fakeReadyState = WebSocketFields.OPEN; | ||
@@ -290,3 +290,6 @@ fakeProtocol = protocol; | ||
fakeReadyState = WebSocketFields.CLOSED; | ||
socket.dispatchEvent(new Event("error")); | ||
}); | ||
const sendData = websocket[0]; | ||
const close = websocket[1]; | ||
// protocol is always an empty before connecting | ||
@@ -319,2 +322,5 @@ // updated when we receive the metadata | ||
}; | ||
socket.close = function (code, reason) { | ||
close(code, reason); | ||
}; | ||
Object.defineProperty(socket, 'url', { | ||
@@ -321,0 +327,0 @@ get: () => remote.toString(), |
{ | ||
"name": "@mercuryworkshop/bare-mux", | ||
"version": "1.1.2", | ||
"version": "1.1.3", | ||
"description": "", | ||
"type": "module", | ||
"scripts": { | ||
"build": "rollup -c" | ||
}, | ||
"author": "", | ||
@@ -18,3 +15,6 @@ "main": "dist/index.cjs", | ||
}, | ||
"./node": "./lib/index.cjs" | ||
"./node": { | ||
"types": "./lib/index.d.ts", | ||
"main": "./lib/index.cjs" | ||
} | ||
}, | ||
@@ -36,3 +36,6 @@ "files": [ | ||
"uuid": "^9.0.1" | ||
}, | ||
"scripts": { | ||
"build": "rollup -c" | ||
} | ||
} |
@@ -24,3 +24,3 @@ # Bare-Mux | ||
onerror: (error: string) => void, | ||
) => (data: Blob | ArrayBuffer | string) => void; | ||
) => [( (data: Blob | ArrayBuffer | string) => void, (code: number, reason: string) => void )] => void; | ||
@@ -27,0 +27,0 @@ request: ( |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
114494
993