mirror of
https://github.com/MercuryWorkshop/bare-mux.git
synced 2025-05-15 07:10:00 -04:00
support safari with a workaround, clean up code a bit
This commit is contained in:
parent
e82c0f0d08
commit
63211161f1
3 changed files with 29 additions and 11 deletions
|
@ -1,5 +1,5 @@
|
|||
import { BareHeaders, BareTransport, maxRedirects } from './baretypes';
|
||||
import { WorkerConnection, WorkerMessage, WorkerResponse } from './connection';
|
||||
import { BareHeaders, maxRedirects } from './baretypes';
|
||||
import { WorkerConnection, WorkerMessage } from './connection';
|
||||
import { WebSocketFields } from './snapshot';
|
||||
|
||||
const validChars =
|
||||
|
@ -17,12 +17,6 @@ export function validProtocol(protocol: string): boolean {
|
|||
return true;
|
||||
}
|
||||
|
||||
// get the unhooked value
|
||||
const getRealReadyState = Object.getOwnPropertyDescriptor(
|
||||
WebSocket.prototype,
|
||||
'readyState'
|
||||
)!.get!;
|
||||
|
||||
const wsProtocols = ['ws:', 'wss:'];
|
||||
const statusEmpty = [101, 204, 205, 304];
|
||||
const statusRedirect = [301, 302, 303, 307, 308];
|
||||
|
@ -238,7 +232,7 @@ export class BareClient {
|
|||
}
|
||||
};
|
||||
|
||||
const onclose = (code, reason) => {
|
||||
const onclose = (code: number, reason: string) => {
|
||||
fakeReadyState = WebSocketFields.CLOSED;
|
||||
socket.dispatchEvent(new CloseEvent("close", { code, reason }));
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue