@s21g/peerjs 1.5.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +22 -0
- package/README.md +277 -0
- package/dist/bundler.cjs +1678 -0
- package/dist/bundler.cjs.map +1 -0
- package/dist/bundler.mjs +1896 -0
- package/dist/bundler.mjs.map +1 -0
- package/dist/peerjs.js +4718 -0
- package/dist/peerjs.js.map +1 -0
- package/dist/peerjs.min.js +8 -0
- package/dist/peerjs.min.js.map +1 -0
- package/dist/serializer.msgpack.mjs +2 -0
- package/dist/serializer.msgpack.mjs.map +1 -0
- package/dist/types.d.ts +641 -0
- package/dist/types.d.ts.map +1 -0
- package/package.json +218 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";;;;;;;;AEAO,MAAM;;aACH,aAAa,MAAO,4JAA4J;;QAEzL,eAAe;aAEP,aAAqB;aAE7B,QAAQ,CACP;YAEA,MAAM,SAAS,EAAE;YACjB,MAAM,OAAO,KAAK,UAAU;YAC5B,MAAM,QAAQ,KAAK,IAAI,CAAC,OAAO,IAAI,CAAC,UAAU;YAE9C,IAAI,QAAQ;YACZ,IAAI,QAAQ;YAEZ,MAAO,QAAQ,KAAM;gBACpB,MAAM,MAAM,KAAK,GAAG,CAAC,MAAM,QAAQ,IAAI,CAAC,UAAU;gBAClD,MAAM,IAAI,KAAK,KAAK,CAAC,OAAO;gBAE5B,MAAM,QAAQ;oBACb,YAAY,IAAI,CAAC,UAAU;oBAC3B,GAAG;oBACH,MAAM;2BACN;gBACD;gBAEA,OAAO,IAAI,CAAC;gBAEZ,QAAQ;gBACR;YACD;YAEA,IAAI,CAAC,UAAU;YAEf,OAAO;QACR;;AACD;AAEO,SAAS,0CAAmB,IAAkB;IACpD,IAAI,OAAO;IACX,KAAK,MAAM,OAAO,KACjB,QAAQ,IAAI,UAAU;IAEvB,MAAM,SAAS,IAAI,WAAW;IAC9B,IAAI,SAAS;IACb,KAAK,MAAM,O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;oBACV;gBACD;gBACA,IAAI,CAAC,IAAI,CAAC,QAAQ;YACnB;QACD,CAAA;IACD;IAEmB,MAAM,IAAI,EAAE;QAC9B,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC;IAC/C;AACD;;;ADtBO,MAAM,kDAAoB,CAAA,GAAA,yCAAG;;QAA7B,qBACG,eAAkC;qBAC1C;YACA,SAAS,CAAA,GAAA,yCAAM;QAChB;;AACD;;;;;;;;ItBeA,2CAAe,CAAA,GAAA,yCAAG","sources":["lib/exports.ts","lib/util.ts","lib/dataconnection/BufferedConnection/binaryPackChunker.ts","lib/supports.ts","lib/utils/validateId.ts","lib/utils/randomToken.ts","lib/peer.ts","lib/logger.ts","lib/socket.ts","node_modules/eventemitter3/index.js","lib/enums.ts","package.json","lib/mediaconnection.ts","lib/negotiator.ts","lib/baseconnection.ts","lib/peerError.ts","lib/api.ts","lib/dataconnection/BufferedConnection/BinaryPack.ts","lib/dataconnection/BufferedConnection/BufferedConnection.ts","lib/dataconnection/DataConnection.ts","lib/dataconnection/BufferedConnection/Raw.ts","lib/dataconnection/BufferedConnection/Json.ts","lib/msgPackPeer.ts","lib/dataconnection/StreamConnection/MsgPack.ts","lib/dataconnection/StreamConnection/StreamConnection.ts"],"sourcesContent":["export { util, type Util } from \"./util\";\nimport { Peer } from \"./peer\";\nimport { MsgPackPeer } from \"./msgPackPeer\";\n\nexport type { PeerEvents, PeerOptions } from \"./peer\";\n\nexport type {\n\tPeerJSOption,\n\tPeerConnectOption,\n\tAnswerOption,\n\tCallOption,\n} from \"./optionInterfaces\";\nexport type { UtilSupportsObj } from \"./util\";\nexport type { DataConnection } from \"./dataconnection/DataConnection\";\nexport type { MediaConnection } from \"./mediaconnection\";\nexport type { LogLevel } from \"./logger\";\nexport * from \"./enums\";\n\nexport { BufferedConnection } from \"./dataconnection/BufferedConnection/BufferedConnection\";\nexport { StreamConnection } from \"./dataconnection/StreamConnection/StreamConnection\";\nexport { MsgPack } from \"./dataconnection/StreamConnection/MsgPack\";\nexport type { SerializerMapping } from \"./peer\";\n\nexport { Peer, MsgPackPeer };\n\nexport { PeerError } from \"./peerError\";\nexport default Peer;\n","import { BinaryPackChunker } from \"./dataconnection/BufferedConnection/binaryPackChunker\";\nimport * as BinaryPack from \"peerjs-js-binarypack\";\nimport { Supports } from \"./supports\";\nimport { validateId } from \"./utils/validateId\";\nimport { randomToken } from \"./utils/randomToken\";\n\nexport interface UtilSupportsObj {\n\t/**\n\t * The current browser.\n\t * This property can be useful in determining whether two peers can connect.\n\t *\n\t * ```ts\n\t * if (util.browser === 'firefox') {\n\t * // OK to peer with Firefox peers.\n\t * }\n\t * ```\n\t *\n\t * `util.browser` can currently have the values\n\t * `'firefox', 'chrome', 'safari', 'edge', 'Not a supported browser.', 'Not a browser.' (unknown WebRTC-compatible agent).\n\t */\n\tbrowser: boolean;\n\twebRTC: boolean;\n\t/**\n\t * True if the current browser supports media streams and PeerConnection.\n\t */\n\taudioVideo: boolean;\n\t/**\n\t * True if the current browser supports DataChannel and PeerConnection.\n\t */\n\tdata: boolean;\n\tbinaryBlob: boolean;\n\t/**\n\t * True if the current browser supports reliable DataChannels.\n\t */\n\treliable: boolean;\n}\n\nconst DEFAULT_CONFIG = {\n\ticeServers: [\n\t\t{ urls: \"stun:stun.l.google.com:19302\" },\n\t\t{\n\t\t\turls: [\n\t\t\t\t\"turn:eu-0.turn.peerjs.com:3478\",\n\t\t\t\t\"turn:us-0.turn.peerjs.com:3478\",\n\t\t\t],\n\t\t\tusername: \"peerjs\",\n\t\t\tcredential: \"peerjsp\",\n\t\t},\n\t],\n\tsdpSemantics: \"unified-plan\",\n};\n\nexport class Util extends BinaryPackChunker {\n\tnoop(): void {}\n\n\treadonly CLOUD_HOST = \"0.peerjs.com\";\n\treadonly CLOUD_PORT = 443;\n\n\t// Browsers that need chunking:\n\treadonly chunkedBrowsers = { Chrome: 1, chrome: 1 };\n\n\t// Returns browser-agnostic default config\n\treadonly defaultConfig = DEFAULT_CONFIG;\n\n\treadonly browser = Supports.getBrowser();\n\treadonly browserVersion = Supports.getVersion();\n\n\tpack = BinaryPack.pack;\n\tunpack = BinaryPack.unpack;\n\n\t/**\n\t * A hash of WebRTC features mapped to booleans that correspond to whether the feature is supported by the current browser.\n\t *\n\t * :::caution\n\t * Only the properties documented here are guaranteed to be present on `util.supports`\n\t * :::\n\t */\n\treadonly supports = (function () {\n\t\tconst supported: UtilSupportsObj = {\n\t\t\tbrowser: Supports.isBrowserSupported(),\n\t\t\twebRTC: Supports.isWebRTCSupported(),\n\t\t\taudioVideo: false,\n\t\t\tdata: false,\n\t\t\tbinaryBlob: false,\n\t\t\treliable: false,\n\t\t};\n\n\t\tif (!supported.webRTC) return supported;\n\n\t\tlet pc: RTCPeerConnection;\n\n\t\ttry {\n\t\t\tpc = new RTCPeerConnection(DEFAULT_CONFIG);\n\n\t\t\tsupported.audioVideo = true;\n\n\t\t\tlet dc: RTCDataChannel;\n\n\t\t\ttry {\n\t\t\t\tdc = pc.createDataChannel(\"_PEERJSTEST\", { ordered: true });\n\t\t\t\tsupported.data = true;\n\t\t\t\tsupported.reliable = !!dc.ordered;\n\n\t\t\t\t// Binary test\n\t\t\t\ttry {\n\t\t\t\t\tdc.binaryType = \"blob\";\n\t\t\t\t\tsupported.binaryBlob = !Supports.isIOS;\n\t\t\t\t} catch (e) {}\n\t\t\t} catch (e) {\n\t\t\t} finally {\n\t\t\t\tif (dc) {\n\t\t\t\t\tdc.close();\n\t\t\t\t}\n\t\t\t}\n\t\t} catch (e) {\n\t\t} finally {\n\t\t\tif (pc) {\n\t\t\t\tpc.close();\n\t\t\t}\n\t\t}\n\n\t\treturn supported;\n\t})();\n\n\t// Ensure alphanumeric ids\n\tvalidateId = validateId;\n\trandomToken = randomToken;\n\n\tblobToArrayBuffer(\n\t\tblob: Blob,\n\t\tcb: (arg: ArrayBuffer | null) => void,\n\t): FileReader {\n\t\tconst fr = new FileReader();\n\n\t\tfr.onload = function (evt) {\n\t\t\tif (evt.target) {\n\t\t\t\tcb(evt.target.result as ArrayBuffer);\n\t\t\t}\n\t\t};\n\n\t\tfr.readAsArrayBuffer(blob);\n\n\t\treturn fr;\n\t}\n\n\tbinaryStringToArrayBuffer(binary: string): ArrayBuffer | SharedArrayBuffer {\n\t\tconst byteArray = new Uint8Array(binary.length);\n\n\t\tfor (let i = 0; i < binary.length; i++) {\n\t\t\tbyteArray[i] = binary.charCodeAt(i) & 0xff;\n\t\t}\n\n\t\treturn byteArray.buffer;\n\t}\n\tisSecure(): boolean {\n\t\treturn location.protocol === \"https:\";\n\t}\n}\n\n/**\n * Provides a variety of helpful utilities.\n *\n * :::caution\n * Only the utilities documented here are guaranteed to be present on `util`.\n * Undocumented utilities can be removed without warning.\n * We don't consider these to be breaking changes.\n * :::\n */\nexport const util = new Util();\n","export class BinaryPackChunker {\n\treadonly chunkedMTU = 16300; // The original 60000 bytes setting does not work when sending data from Firefox to Chrome, which is \"cut off\" after 16384 bytes and delivered individually.\n\n\t// Binary stuff\n\n\tprivate _dataCount: number = 1;\n\n\tchunk = (\n\t\tblob: ArrayBuffer,\n\t): { __peerData: number; n: number; total: number; data: Uint8Array }[] => {\n\t\tconst chunks = [];\n\t\tconst size = blob.byteLength;\n\t\tconst total = Math.ceil(size / this.chunkedMTU);\n\n\t\tlet index = 0;\n\t\tlet start = 0;\n\n\t\twhile (start < size) {\n\t\t\tconst end = Math.min(size, start + this.chunkedMTU);\n\t\t\tconst b = blob.slice(start, end);\n\n\t\t\tconst chunk = {\n\t\t\t\t__peerData: this._dataCount,\n\t\t\t\tn: index,\n\t\t\t\tdata: b,\n\t\t\t\ttotal,\n\t\t\t};\n\n\t\t\tchunks.push(chunk);\n\n\t\t\tstart = end;\n\t\t\tindex++;\n\t\t}\n\n\t\tthis._dataCount++;\n\n\t\treturn chunks;\n\t};\n}\n\nexport function concatArrayBuffers(bufs: Uint8Array[]) {\n\tlet size = 0;\n\tfor (const buf of bufs) {\n\t\tsize += buf.byteLength;\n\t}\n\tconst result = new Uint8Array(size);\n\tlet offset = 0;\n\tfor (const buf of bufs) {\n\t\tresult.set(buf, offset);\n\t\toffset += buf.byteLength;\n\t}\n\treturn result;\n}\n","import webRTCAdapter_import from \"webrtc-adapter\";\n\nconst webRTCAdapter: typeof webRTCAdapter_import =\n\t//@ts-ignore\n\twebRTCAdapter_import.default || webRTCAdapter_import;\n\nexport const Supports = new (class {\n\treadonly isIOS =\n\t\ttypeof navigator !== \"undefined\"\n\t\t\t? [\"iPad\", \"iPhone\", \"iPod\"].includes(navigator.platform)\n\t\t\t: false;\n\treadonly supportedBrowsers = [\"firefox\", \"chrome\", \"safari\"];\n\n\treadonly minFirefoxVersion = 59;\n\treadonly minChromeVersion = 72;\n\treadonly minSafariVersion = 605;\n\n\tisWebRTCSupported(): boolean {\n\t\treturn typeof RTCPeerConnection !== \"undefined\";\n\t}\n\n\tisBrowserSupported(): boolean {\n\t\tconst browser = this.getBrowser();\n\t\tconst version = this.getVersion();\n\n\t\tconst validBrowser = this.supportedBrowsers.includes(browser);\n\n\t\tif (!validBrowser) return false;\n\n\t\tif (browser === \"chrome\") return version >= this.minChromeVersion;\n\t\tif (browser === \"firefox\") return version >= this.minFirefoxVersion;\n\t\tif (browser === \"safari\")\n\t\t\treturn !this.isIOS && version >= this.minSafariVersion;\n\n\t\treturn false;\n\t}\n\n\tgetBrowser(): string {\n\t\treturn webRTCAdapter.browserDetails.browser;\n\t}\n\n\tgetVersion(): number {\n\t\treturn webRTCAdapter.browserDetails.version || 0;\n\t}\n\n\tisUnifiedPlanSupported(): boolean {\n\t\tconst browser = this.getBrowser();\n\t\tconst version = webRTCAdapter.browserDetails.version || 0;\n\n\t\tif (browser === \"chrome\" && version < this.minChromeVersion) return false;\n\t\tif (browser === \"firefox\" && version >= this.minFirefoxVersion) return true;\n\t\tif (\n\t\t\t!window.RTCRtpTransceiver ||\n\t\t\t!(\"currentDirection\" in RTCRtpTransceiver.prototype)\n\t\t)\n\t\t\treturn false;\n\n\t\tlet tempPc: RTCPeerConnection;\n\t\tlet supported = false;\n\n\t\ttry {\n\t\t\ttempPc = new RTCPeerConnection();\n\t\t\ttempPc.addTransceiver(\"audio\");\n\t\t\tsupported = true;\n\t\t} catch (e) {\n\t\t} finally {\n\t\t\tif (tempPc) {\n\t\t\t\ttempPc.close();\n\t\t\t}\n\t\t}\n\n\t\treturn supported;\n\t}\n\n\ttoString(): string {\n\t\treturn `Supports:\n browser:${this.getBrowser()}\n version:${this.getVersion()}\n isIOS:${this.isIOS}\n isWebRTCSupported:${this.isWebRTCSupported()}\n isBrowserSupported:${this.isBrowserSupported()}\n isUnifiedPlanSupported:${this.isUnifiedPlanSupported()}`;\n\t}\n})();\n","export const validateId = (id: string): boolean => {\n\t// Allow empty ids\n\treturn !id || /^[A-Za-z0-9]+(?:[ _-][A-Za-z0-9]+)*$/.test(id);\n};\n","export const randomToken = () => Math.random().toString(36).slice(2);\n","import { util } from \"./util\";\nimport logger, { LogLevel } from \"./logger\";\nimport { Socket } from \"./socket\";\nimport { MediaConnection } from \"./mediaconnection\";\nimport type { DataConnection } from \"./dataconnection/DataConnection\";\nimport {\n\tConnectionType,\n\tPeerErrorType,\n\tServerMessageType,\n\tSocketEventType,\n} from \"./enums\";\nimport type { ServerMessage } from \"./servermessage\";\nimport { API } from \"./api\";\nimport type {\n\tCallOption,\n\tPeerConnectOption,\n\tPeerJSOption,\n} from \"./optionInterfaces\";\nimport { BinaryPack } from \"./dataconnection/BufferedConnection/BinaryPack\";\nimport { Raw } from \"./dataconnection/BufferedConnection/Raw\";\nimport { Json } from \"./dataconnection/BufferedConnection/Json\";\n\nimport { EventEmitterWithError, PeerError } from \"./peerError\";\n\nclass PeerOptions implements PeerJSOption {\n\t/**\n\t * Prints log messages depending on the debug level passed in.\n\t */\n\tdebug?: LogLevel;\n\t/**\n\t * Server host. Defaults to `0.peerjs.com`.\n\t * Also accepts `'/'` to signify relative hostname.\n\t */\n\thost?: string;\n\t/**\n\t * Server port. Defaults to `443`.\n\t */\n\tport?: number;\n\t/**\n\t * The path where your self-hosted PeerServer is running. Defaults to `'/'`\n\t */\n\tpath?: string;\n\t/**\n\t * API key for the PeerServer.\n\t * This is not used anymore.\n\t */\n\tkey?: string;\n\ttoken?: string;\n\t/**\n\t * Configuration hash passed to RTCPeerConnection.\n\t * This hash contains any custom ICE/TURN server configuration.\n\t *\n\t * Defaults to {@apilink util.defaultConfig}\n\t */\n\tconfig?: any;\n\t/**\n\t * Set to true `true` if you're using TLS.\n\t * :::danger\n\t * If possible *always use TLS*\n\t * :::\n\t */\n\tsecure?: boolean;\n\tpingInterval?: number;\n\treferrerPolicy?: ReferrerPolicy;\n\tlogFunction?: (logLevel: LogLevel, ...rest: any[]) => void;\n\tserializers?: SerializerMapping;\n}\n\nexport { type PeerOptions };\n\nexport interface SerializerMapping {\n\t[key: string]: new (\n\t\tpeerId: string,\n\t\tprovider: Peer,\n\t\toptions: any,\n\t) => DataConnection;\n}\n\nexport interface PeerEvents {\n\t/**\n\t * Emitted when a connection to the PeerServer is established.\n\t *\n\t * You may use the peer before this is emitted, but messages to the server will be queued. <code>id</code> is the brokering ID of the peer (which was either provided in the constructor or assigned by the server).<span class='tip'>You should not wait for this event before connecting to other peers if connection speed is important.</span>\n\t */\n\topen: (id: string) => void;\n\t/**\n\t * Emitted when a new data connection is established from a remote peer.\n\t */\n\tconnection: (dataConnection: DataConnection) => void;\n\t/**\n\t * Emitted when a remote peer attempts to call you.\n\t */\n\tcall: (mediaConnection: MediaConnection) => void;\n\t/**\n\t * Emitted when the peer is destroyed and can no longer accept or create any new connections.\n\t */\n\tclose: () => void;\n\t/**\n\t * Emitted when the peer is disconnected from the signalling server\n\t */\n\tdisconnected: (currentId: string) => void;\n\t/**\n\t * Errors on the peer are almost always fatal and will destroy the peer.\n\t *\n\t * Errors from the underlying socket and PeerConnections are forwarded here.\n\t */\n\terror: (error: PeerError<`${PeerErrorType}`>) => void;\n}\n/**\n * A peer who can initiate connections with other peers.\n */\nexport class Peer extends EventEmitterWithError<PeerErrorType, PeerEvents> {\n\tprivate static readonly DEFAULT_KEY = \"peerjs\";\n\n\tprotected readonly _serializers: SerializerMapping = {\n\t\traw: Raw,\n\t\tjson: Json,\n\t\tbinary: BinaryPack,\n\t\t\"binary-utf8\": BinaryPack,\n\n\t\tdefault: BinaryPack,\n\t};\n\tprivate readonly _options: PeerOptions;\n\tprivate readonly _api: API;\n\tprivate readonly _socket: Socket;\n\n\tprivate _id: string | null = null;\n\tprivate _lastServerId: string | null = null;\n\n\t// States.\n\tprivate _destroyed = false; // Connections have been killed\n\tprivate _disconnected = false; // Connection to PeerServer killed but P2P connections still active\n\tprivate _open = false; // Sockets and such are not yet open.\n\tprivate readonly _connections: Map<\n\t\tstring,\n\t\t(DataConnection | MediaConnection)[]\n\t> = new Map(); // All connections for this peer.\n\tprivate readonly _lostMessages: Map<string, ServerMessage[]> = new Map(); // src => [list of messages]\n\t/**\n\t * The brokering ID of this peer\n\t *\n\t * If no ID was specified in {@apilink Peer | the constructor},\n\t * this will be `undefined` until the {@apilink PeerEvents | `open`} event is emitted.\n\t */\n\tget id() {\n\t\treturn this._id;\n\t}\n\n\tget options() {\n\t\treturn this._options;\n\t}\n\n\tget open() {\n\t\treturn this._open;\n\t}\n\n\t/**\n\t * @internal\n\t */\n\tget socket() {\n\t\treturn this._socket;\n\t}\n\n\t/**\n\t * A hash of all connections associated with this peer, keyed by the remote peer's ID.\n\t * @deprecated\n\t * Return type will change from Object to Map<string,[]>\n\t */\n\tget connections(): Object {\n\t\tconst plainConnections = Object.create(null);\n\n\t\tfor (const [k, v] of this._connections) {\n\t\t\tplainConnections[k] = v;\n\t\t}\n\n\t\treturn plainConnections;\n\t}\n\n\t/**\n\t * true if this peer and all of its connections can no longer be used.\n\t */\n\tget destroyed() {\n\t\treturn this._destroyed;\n\t}\n\t/**\n\t * false if there is an active connection to the PeerServer.\n\t */\n\tget disconnected() {\n\t\treturn this._disconnected;\n\t}\n\n\t/**\n\t * A peer can connect to other peers and listen for connections.\n\t */\n\tconstructor();\n\n\t/**\n\t * A peer can connect to other peers and listen for connections.\n\t * @param options for specifying details about PeerServer\n\t */\n\tconstructor(options: PeerOptions);\n\n\t/**\n\t * A peer can connect to other peers and listen for connections.\n\t * @param id Other peers can connect to this peer using the provided ID.\n\t * If no ID is given, one will be generated by the brokering server.\n\t * The ID must start and end with an alphanumeric character (lower or upper case character or a digit). In the middle of the ID spaces, dashes (-) and underscores (_) are allowed. Use {@apilink PeerOptions.metadata } to send identifying information.\n\t * @param options for specifying details about PeerServer\n\t */\n\tconstructor(id: string, options?: PeerOptions);\n\n\tconstructor(id?: string | PeerOptions, options?: PeerOptions) {\n\t\tsuper();\n\n\t\tlet userId: string | undefined;\n\n\t\t// Deal with overloading\n\t\tif (id && id.constructor == Object) {\n\t\t\toptions = id as PeerOptions;\n\t\t} else if (id) {\n\t\t\tuserId = id.toString();\n\t\t}\n\n\t\t// Configurize options\n\t\toptions = {\n\t\t\tdebug: 0, // 1: Errors, 2: Warnings, 3: All logs\n\t\t\thost: util.CLOUD_HOST,\n\t\t\tport: util.CLOUD_PORT,\n\t\t\tpath: \"/\",\n\t\t\tkey: Peer.DEFAULT_KEY,\n\t\t\ttoken: util.randomToken(),\n\t\t\tconfig: util.defaultConfig,\n\t\t\treferrerPolicy: \"strict-origin-when-cross-origin\",\n\t\t\tserializers: {},\n\t\t\t...options,\n\t\t};\n\t\tthis._options = options;\n\t\tthis._serializers = { ...this._serializers, ...this.options.serializers };\n\n\t\t// Detect relative URL host.\n\t\tif (this._options.host === \"/\") {\n\t\t\tthis._options.host = window.location.hostname;\n\t\t}\n\n\t\t// Set path correctly.\n\t\tif (this._options.path) {\n\t\t\tif (this._options.path[0] !== \"/\") {\n\t\t\t\tthis._options.path = \"/\" + this._options.path;\n\t\t\t}\n\t\t\tif (this._options.path[this._options.path.length - 1] !== \"/\") {\n\t\t\t\tthis._options.path += \"/\";\n\t\t\t}\n\t\t}\n\n\t\t// Set whether we use SSL to same as current host\n\t\tif (\n\t\t\tthis._options.secure === undefined &&\n\t\t\tthis._options.host !== util.CLOUD_HOST\n\t\t) {\n\t\t\tthis._options.secure = util.isSecure();\n\t\t} else if (this._options.host == util.CLOUD_HOST) {\n\t\t\tthis._options.secure = true;\n\t\t}\n\t\t// Set a custom log function if present\n\t\tif (this._options.logFunction) {\n\t\t\tlogger.setLogFunction(this._options.logFunction);\n\t\t}\n\n\t\tlogger.logLevel = this._options.debug || 0;\n\n\t\tthis._api = new API(options);\n\t\tthis._socket = this._createServerConnection();\n\n\t\t// Sanity checks\n\t\t// Ensure WebRTC supported\n\t\tif (!util.supports.audioVideo && !util.supports.data) {\n\t\t\tthis._delayedAbort(\n\t\t\t\tPeerErrorType.BrowserIncompatible,\n\t\t\t\t\"The current browser does not support WebRTC\",\n\t\t\t);\n\t\t\treturn;\n\t\t}\n\n\t\t// Ensure alphanumeric id\n\t\tif (!!userId && !util.validateId(userId)) {\n\t\t\tthis._delayedAbort(PeerErrorType.InvalidID, `ID \"${userId}\" is invalid`);\n\t\t\treturn;\n\t\t}\n\n\t\tif (userId) {\n\t\t\tthis._initialize(userId);\n\t\t} else {\n\t\t\tthis._api\n\t\t\t\t.retrieveId()\n\t\t\t\t.then((id) => this._initialize(id))\n\t\t\t\t.catch((error) => this._abort(PeerErrorType.ServerError, error));\n\t\t}\n\t}\n\n\tprivate _createServerConnection(): Socket {\n\t\tconst socket = new Socket(\n\t\t\tthis._options.secure,\n\t\t\tthis._options.host!,\n\t\t\tthis._options.port!,\n\t\t\tthis._options.path!,\n\t\t\tthis._options.key!,\n\t\t\tthis._options.pingInterval,\n\t\t);\n\n\t\tsocket.on(SocketEventType.Message, (data: ServerMessage) => {\n\t\t\tthis._handleMessage(data);\n\t\t});\n\n\t\tsocket.on(SocketEventType.Error, (error: string) => {\n\t\t\tthis._abort(PeerErrorType.SocketError, error);\n\t\t});\n\n\t\tsocket.on(SocketEventType.Disconnected, () => {\n\t\t\tif (this.disconnected) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tthis.emitError(PeerErrorType.Network, \"Lost connection to server.\");\n\t\t\tthis.disconnect();\n\t\t});\n\n\t\tsocket.on(SocketEventType.Close, () => {\n\t\t\tif (this.disconnected) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tthis._abort(\n\t\t\t\tPeerErrorType.SocketClosed,\n\t\t\t\t\"Underlying socket is already closed.\",\n\t\t\t);\n\t\t});\n\n\t\treturn socket;\n\t}\n\n\t/** Initialize a connection with the server. */\n\tprivate _initialize(id: string): void {\n\t\tthis._id = id;\n\t\tthis.socket.start(id, this._options.token!);\n\t}\n\n\t/** Handles messages from the server. */\n\tprivate _handleMessage(message: ServerMessage): void {\n\t\tconst type = message.type;\n\t\tconst payload = message.payload;\n\t\tconst peerId = message.src;\n\n\t\tswitch (type) {\n\t\t\tcase ServerMessageType.Open: // The connection to the server is open.\n\t\t\t\tthis._lastServerId = this.id;\n\t\t\t\tthis._open = true;\n\t\t\t\tthis.emit(\"open\", this.id);\n\t\t\t\tbreak;\n\t\t\tcase ServerMessageType.Error: // Server error.\n\t\t\t\tthis._abort(PeerErrorType.ServerError, payload.msg);\n\t\t\t\tbreak;\n\t\t\tcase ServerMessageType.IdTaken: // The selected ID is taken.\n\t\t\t\tthis._abort(PeerErrorType.UnavailableID, `ID \"${this.id}\" is taken`);\n\t\t\t\tbreak;\n\t\t\tcase ServerMessageType.InvalidKey: // The given API key cannot be found.\n\t\t\t\tthis._abort(\n\t\t\t\t\tPeerErrorType.InvalidKey,\n\t\t\t\t\t`API KEY \"${this._options.key}\" is invalid`,\n\t\t\t\t);\n\t\t\t\tbreak;\n\t\t\tcase ServerMessageType.Leave: // Another peer has closed its connection to this peer.\n\t\t\t\tlogger.log(`Received leave message from ${peerId}`);\n\t\t\t\tthis._cleanupPeer(peerId);\n\t\t\t\tthis._connections.delete(peerId);\n\t\t\t\tbreak;\n\t\t\tcase ServerMessageType.Expire: // The offer sent to a peer has expired without response.\n\t\t\t\tthis.emitError(\n\t\t\t\t\tPeerErrorType.PeerUnavailable,\n\t\t\t\t\t`Could not connect to peer ${peerId}`,\n\t\t\t\t);\n\t\t\t\tbreak;\n\t\t\tcase ServerMessageType.Offer: {\n\t\t\t\t// we should consider switching this to CALL/CONNECT, but this is the least breaking option.\n\t\t\t\tconst connectionId = payload.connectionId;\n\t\t\t\tlet connection = this.getConnection(peerId, connectionId);\n\n\t\t\t\tif (connection) {\n\t\t\t\t\tconnection.close();\n\t\t\t\t\tlogger.warn(\n\t\t\t\t\t\t`Offer received for existing Connection ID:${connectionId}`,\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\t// Create a new connection.\n\t\t\t\tif (payload.type === ConnectionType.Media) {\n\t\t\t\t\tconst mediaConnection = new MediaConnection(peerId, this, {\n\t\t\t\t\t\tconnectionId: connectionId,\n\t\t\t\t\t\t_payload: payload,\n\t\t\t\t\t\tmetadata: payload.metadata,\n\t\t\t\t\t});\n\t\t\t\t\tconnection = mediaConnection;\n\t\t\t\t\tthis._addConnection(peerId, connection);\n\t\t\t\t\tthis.emit(\"call\", mediaConnection);\n\t\t\t\t} else if (payload.type === ConnectionType.Data) {\n\t\t\t\t\tconst dataConnection = new this._serializers[payload.serialization](\n\t\t\t\t\t\tpeerId,\n\t\t\t\t\t\tthis,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tconnectionId: connectionId,\n\t\t\t\t\t\t\t_payload: payload,\n\t\t\t\t\t\t\tmetadata: payload.metadata,\n\t\t\t\t\t\t\tlabel: payload.label,\n\t\t\t\t\t\t\tserialization: payload.serialization,\n\t\t\t\t\t\t\treliable: payload.reliable,\n\t\t\t\t\t\t},\n\t\t\t\t\t);\n\t\t\t\t\tconnection = dataConnection;\n\n\t\t\t\t\tthis._addConnection(peerId, connection);\n\t\t\t\t\tthis.emit(\"connection\", dataConnection);\n\t\t\t\t} else {\n\t\t\t\t\tlogger.warn(`Received malformed connection type:${payload.type}`);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Find messages.\n\t\t\t\tconst messages = this._getMessages(connectionId);\n\t\t\t\tfor (const message of messages) {\n\t\t\t\t\tconnection.handleMessage(message);\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdefault: {\n\t\t\t\tif (!payload) {\n\t\t\t\t\tlogger.warn(\n\t\t\t\t\t\t`You received a malformed message from ${peerId} of type ${type}`,\n\t\t\t\t\t);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst connectionId = payload.connectionId;\n\t\t\t\tconst connection = this.getConnection(peerId, connectionId);\n\n\t\t\t\tif (connection && connection.peerConnection) {\n\t\t\t\t\t// Pass it on.\n\t\t\t\t\tconnection.handleMessage(message);\n\t\t\t\t} else if (connectionId) {\n\t\t\t\t\t// Store for possible later use\n\t\t\t\t\tthis._storeMessage(connectionId, message);\n\t\t\t\t} else {\n\t\t\t\t\tlogger.warn(\"You received an unrecognized message:\", message);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\t/** Stores messages without a set up connection, to be claimed later. */\n\tprivate _storeMessage(connectionId: string, message: ServerMessage): void {\n\t\tif (!this._lostMessages.has(connectionId)) {\n\t\t\tthis._lostMessages.set(connectionId, []);\n\t\t}\n\n\t\tthis._lostMessages.get(connectionId).push(message);\n\t}\n\n\t/**\n\t * Retrieve messages from lost message store\n\t * @internal\n\t */\n\t//TODO Change it to private\n\tpublic _getMessages(connectionId: string): ServerMessage[] {\n\t\tconst messages = this._lostMessages.get(connectionId);\n\n\t\tif (messages) {\n\t\t\tthis._lostMessages.delete(connectionId);\n\t\t\treturn messages;\n\t\t}\n\n\t\treturn [];\n\t}\n\n\t/**\n\t * Connects to the remote peer specified by id and returns a data connection.\n\t * @param peer The brokering ID of the remote peer (their {@apilink Peer.id}).\n\t * @param options for specifying details about Peer Connection\n\t */\n\tconnect(peer: string, options: PeerConnectOption = {}): DataConnection {\n\t\toptions = {\n\t\t\tserialization: \"default\",\n\t\t\t...options,\n\t\t};\n\t\tif (this.disconnected) {\n\t\t\tlogger.warn(\n\t\t\t\t\"You cannot connect to a new Peer because you called \" +\n\t\t\t\t\t\".disconnect() on this Peer and ended your connection with the \" +\n\t\t\t\t\t\"server. You can create a new Peer to reconnect, or call reconnect \" +\n\t\t\t\t\t\"on this peer if you believe its ID to still be available.\",\n\t\t\t);\n\t\t\tthis.emitError(\n\t\t\t\tPeerErrorType.Disconnected,\n\t\t\t\t\"Cannot connect to new Peer after disconnecting from server.\",\n\t\t\t);\n\t\t\treturn;\n\t\t}\n\n\t\tconst dataConnection = new this._serializers[options.serialization](\n\t\t\tpeer,\n\t\t\tthis,\n\t\t\toptions,\n\t\t);\n\t\tthis._addConnection(peer, dataConnection);\n\t\treturn dataConnection;\n\t}\n\n\t/**\n\t * Calls the remote peer specified by id and returns a media connection.\n\t * @param peer The brokering ID of the remote peer (their peer.id).\n\t * @param stream The caller's media stream\n\t * @param options Metadata associated with the connection, passed in by whoever initiated the connection.\n\t */\n\tcall(\n\t\tpeer: string,\n\t\tstream: MediaStream,\n\t\toptions: CallOption = {},\n\t): MediaConnection {\n\t\tif (this.disconnected) {\n\t\t\tlogger.warn(\n\t\t\t\t\"You cannot connect to a new Peer because you called \" +\n\t\t\t\t\t\".disconnect() on this Peer and ended your connection with the \" +\n\t\t\t\t\t\"server. You can create a new Peer to reconnect.\",\n\t\t\t);\n\t\t\tthis.emitError(\n\t\t\t\tPeerErrorType.Disconnected,\n\t\t\t\t\"Cannot connect to new Peer after disconnecting from server.\",\n\t\t\t);\n\t\t\treturn;\n\t\t}\n\n\t\tif (!stream) {\n\t\t\tlogger.error(\n\t\t\t\t\"To call a peer, you must provide a stream from your browser's `getUserMedia`.\",\n\t\t\t);\n\t\t\treturn;\n\t\t}\n\n\t\tconst mediaConnection = new MediaConnection(peer, this, {\n\t\t\t...options,\n\t\t\t_stream: stream,\n\t\t});\n\t\tthis._addConnection(peer, mediaConnection);\n\t\treturn mediaConnection;\n\t}\n\n\t/** Add a data/media connection to this peer. */\n\tprivate _addConnection(\n\t\tpeerId: string,\n\t\tconnection: MediaConnection | DataConnection,\n\t): void {\n\t\tlogger.log(\n\t\t\t`add connection ${connection.type}:${connection.connectionId} to peerId:${peerId}`,\n\t\t);\n\n\t\tif (!this._connections.has(peerId)) {\n\t\t\tthis._connections.set(peerId, []);\n\t\t}\n\t\tthis._connections.get(peerId).push(connection);\n\t}\n\n\t//TODO should be private\n\t_removeConnection(connection: DataConnection | MediaConnection): void {\n\t\tconst connections = this._connections.get(connection.peer);\n\n\t\tif (connections) {\n\t\t\tconst index = connections.indexOf(connection);\n\n\t\t\tif (index !== -1) {\n\t\t\t\tconnections.splice(index, 1);\n\t\t\t}\n\t\t}\n\n\t\t//remove from lost messages\n\t\tthis._lostMessages.delete(connection.connectionId);\n\t}\n\n\t/** Retrieve a data/media connection for this peer. */\n\tgetConnection(\n\t\tpeerId: string,\n\t\tconnectionId: string,\n\t): null | DataConnection | MediaConnection {\n\t\tconst connections = this._connections.get(peerId);\n\t\tif (!connections) {\n\t\t\treturn null;\n\t\t}\n\n\t\tfor (const connection of connections) {\n\t\t\tif (connection.connectionId === connectionId) {\n\t\t\t\treturn connection;\n\t\t\t}\n\t\t}\n\n\t\treturn null;\n\t}\n\n\tprivate _delayedAbort(type: PeerErrorType, message: string | Error): void {\n\t\tsetTimeout(() => {\n\t\t\tthis._abort(type, message);\n\t\t}, 0);\n\t}\n\n\t/**\n\t * Emits an error message and destroys the Peer.\n\t * The Peer is not destroyed if it's in a disconnected state, in which case\n\t * it retains its disconnected state and its existing connections.\n\t */\n\tprivate _abort(type: PeerErrorType, message: string | Error): void {\n\t\tlogger.error(\"Aborting!\");\n\n\t\tthis.emitError(type, message);\n\n\t\tif (!this._lastServerId) {\n\t\t\tthis.destroy();\n\t\t} else {\n\t\t\tthis.disconnect();\n\t\t}\n\t}\n\n\t/**\n\t * Destroys the Peer: closes all active connections as well as the connection\n\t * to the server.\n\t *\n\t * :::caution\n\t * This cannot be undone; the respective peer object will no longer be able\n\t * to create or receive any connections, its ID will be forfeited on the server,\n\t * and all of its data and media connections will be closed.\n\t * :::\n\t */\n\tdestroy(): void {\n\t\tif (this.destroyed) {\n\t\t\treturn;\n\t\t}\n\n\t\tlogger.log(`Destroy peer with ID:${this.id}`);\n\n\t\tthis.disconnect();\n\t\tthis._cleanup();\n\n\t\tthis._destroyed = true;\n\n\t\tthis.emit(\"close\");\n\t}\n\n\t/** Disconnects every connection on this peer. */\n\tprivate _cleanup(): void {\n\t\tfor (const peerId of this._connections.keys()) {\n\t\t\tthis._cleanupPeer(peerId);\n\t\t\tthis._connections.delete(peerId);\n\t\t}\n\n\t\tthis.socket.removeAllListeners();\n\t}\n\n\t/** Closes all connections to this peer. */\n\tprivate _cleanupPeer(peerId: string): void {\n\t\tconst connections = this._connections.get(peerId);\n\n\t\tif (!connections) return;\n\n\t\tfor (const connection of connections) {\n\t\t\tconnection.close();\n\t\t}\n\t}\n\n\t/**\n\t * Disconnects the Peer's connection to the PeerServer. Does not close any\n\t * active connections.\n\t * Warning: The peer can no longer create or accept connections after being\n\t * disconnected. It also cannot reconnect to the server.\n\t */\n\tdisconnect(): void {\n\t\tif (this.disconnected) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst currentId = this.id;\n\n\t\tlogger.log(`Disconnect peer with ID:${currentId}`);\n\n\t\tthis._disconnected = true;\n\t\tthis._open = false;\n\n\t\tthis.socket.close();\n\n\t\tthis._lastServerId = currentId;\n\t\tthis._id = null;\n\n\t\tthis.emit(\"disconnected\", currentId);\n\t}\n\n\t/** Attempts to reconnect with the same ID.\n\t *\n\t * Only {@apilink Peer.disconnect | disconnected peers} can be reconnected.\n\t * Destroyed peers cannot be reconnected.\n\t * If the connection fails (as an example, if the peer's old ID is now taken),\n\t * the peer's existing connections will not close, but any associated errors events will fire.\n\t */\n\treconnect(): void {\n\t\tif (this.disconnected && !this.destroyed) {\n\t\t\tlogger.log(\n\t\t\t\t`Attempting reconnection to server with ID ${this._lastServerId}`,\n\t\t\t);\n\t\t\tthis._disconnected = false;\n\t\t\tthis._initialize(this._lastServerId!);\n\t\t} else if (this.destroyed) {\n\t\t\tthrow new Error(\n\t\t\t\t\"This peer cannot reconnect to the server. It has already been destroyed.\",\n\t\t\t);\n\t\t} else if (!this.disconnected && !this.open) {\n\t\t\t// Do nothing. We're still connecting the first time.\n\t\t\tlogger.error(\n\t\t\t\t\"In a hurry? We're still trying to make the initial connection!\",\n\t\t\t);\n\t\t} else {\n\t\t\tthrow new Error(\n\t\t\t\t`Peer ${this.id} cannot reconnect because it is not disconnected from the server!`,\n\t\t\t);\n\t\t}\n\t}\n\n\t/**\n\t * Get a list of available peer IDs. If you're running your own server, you'll\n\t * want to set allow_discovery: true in the PeerServer options. If you're using\n\t * the cloud server, email team@peerjs.com to get the functionality enabled for\n\t * your key.\n\t */\n\tlistAllPeers(cb = (_: any[]) => {}): void {\n\t\tthis._api\n\t\t\t.listAllPeers()\n\t\t\t.then((peers) => cb(peers))\n\t\t\t.catch((error) => this._abort(PeerErrorType.ServerError, error));\n\t}\n}\n","const LOG_PREFIX = \"PeerJS: \";\n\n/*\nPrints log messages depending on the debug level passed in. Defaults to 0.\n0 Prints no logs.\n1 Prints only errors.\n2 Prints errors and warnings.\n3 Prints all logs.\n*/\nexport enum LogLevel {\n\t/**\n\t * Prints no logs.\n\t */\n\tDisabled,\n\t/**\n\t * Prints only errors.\n\t */\n\tErrors,\n\t/**\n\t * Prints errors and warnings.\n\t */\n\tWarnings,\n\t/**\n\t * Prints all logs.\n\t */\n\tAll,\n}\n\nclass Logger {\n\tprivate _logLevel = LogLevel.Disabled;\n\n\tget logLevel(): LogLevel {\n\t\treturn this._logLevel;\n\t}\n\n\tset logLevel(logLevel: LogLevel) {\n\t\tthis._logLevel = logLevel;\n\t}\n\n\tlog(...args: any[]) {\n\t\tif (this._logLevel >= LogLevel.All) {\n\t\t\tthis._print(LogLevel.All, ...args);\n\t\t}\n\t}\n\n\twarn(...args: any[]) {\n\t\tif (this._logLevel >= LogLevel.Warnings) {\n\t\t\tthis._print(LogLevel.Warnings, ...args);\n\t\t}\n\t}\n\n\terror(...args: any[]) {\n\t\tif (this._logLevel >= LogLevel.Errors) {\n\t\t\tthis._print(LogLevel.Errors, ...args);\n\t\t}\n\t}\n\n\tsetLogFunction(fn: (logLevel: LogLevel, ..._: any[]) => void): void {\n\t\tthis._print = fn;\n\t}\n\n\tprivate _print(logLevel: LogLevel, ...rest: any[]): void {\n\t\tconst copy = [LOG_PREFIX, ...rest];\n\n\t\tfor (const i in copy) {\n\t\t\tif (copy[i] instanceof Error) {\n\t\t\t\tcopy[i] = \"(\" + copy[i].name + \") \" + copy[i].message;\n\t\t\t}\n\t\t}\n\n\t\tif (logLevel >= LogLevel.All) {\n\t\t\tconsole.log(...copy);\n\t\t} else if (logLevel >= LogLevel.Warnings) {\n\t\t\tconsole.warn(\"WARNING\", ...copy);\n\t\t} else if (logLevel >= LogLevel.Errors) {\n\t\t\tconsole.error(\"ERROR\", ...copy);\n\t\t}\n\t}\n}\n\nexport default new Logger();\n","import { EventEmitter } from \"eventemitter3\";\nimport logger from \"./logger\";\nimport { ServerMessageType, SocketEventType } from \"./enums\";\nimport { version } from \"../package.json\";\n\n/**\n * An abstraction on top of WebSockets to provide fastest\n * possible connection for peers.\n */\nexport class Socket extends EventEmitter {\n\tprivate _disconnected: boolean = true;\n\tprivate _id?: string;\n\tprivate _messagesQueue: Array<object> = [];\n\tprivate _socket?: WebSocket;\n\tprivate _wsPingTimer?: any;\n\tprivate readonly _baseUrl: string;\n\n\tconstructor(\n\t\tsecure: any,\n\t\thost: string,\n\t\tport: number,\n\t\tpath: string,\n\t\tkey: string,\n\t\tprivate readonly pingInterval: number = 5000,\n\t) {\n\t\tsuper();\n\n\t\tconst wsProtocol = secure ? \"wss://\" : \"ws://\";\n\n\t\tthis._baseUrl = wsProtocol + host + \":\" + port + path + \"peerjs?key=\" + key;\n\t}\n\n\tstart(id: string, token: string): void {\n\t\tthis._id = id;\n\n\t\tconst wsUrl = `${this._baseUrl}&id=${id}&token=${token}`;\n\n\t\tif (!!this._socket || !this._disconnected) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis._socket = new WebSocket(wsUrl + \"&version=\" + version);\n\t\tthis._disconnected = false;\n\n\t\tthis._socket.onmessage = (event) => {\n\t\t\tlet data;\n\n\t\t\ttry {\n\t\t\t\tdata = JSON.parse(event.data);\n\t\t\t\tlogger.log(\"Server message received:\", data);\n\t\t\t} catch (e) {\n\t\t\t\tlogger.log(\"Invalid server message\", event.data);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tthis.emit(SocketEventType.Message, data);\n\t\t};\n\n\t\tthis._socket.onclose = (event) => {\n\t\t\tif (this._disconnected) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tlogger.log(\"Socket closed.\", event);\n\n\t\t\tthis._cleanup();\n\t\t\tthis._disconnected = true;\n\n\t\t\tthis.emit(SocketEventType.Disconnected);\n\t\t};\n\n\t\t// Take care of the queue of connections if necessary and make sure Peer knows\n\t\t// socket is open.\n\t\tthis._socket.onopen = () => {\n\t\t\tif (this._disconnected) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tthis._sendQueuedMessages();\n\n\t\t\tlogger.log(\"Socket open\");\n\n\t\t\tthis._scheduleHeartbeat();\n\t\t};\n\t}\n\n\tprivate _scheduleHeartbeat(): void {\n\t\tthis._wsPingTimer = setTimeout(() => {\n\t\t\tthis._sendHeartbeat();\n\t\t}, this.pingInterval);\n\t}\n\n\tprivate _sendHeartbeat(): void {\n\t\tif (!this._wsOpen()) {\n\t\t\tlogger.log(`Cannot send heartbeat, because socket closed`);\n\t\t\treturn;\n\t\t}\n\n\t\tconst message = JSON.stringify({ type: ServerMessageType.Heartbeat });\n\n\t\tthis._socket!.send(message);\n\n\t\tthis._scheduleHeartbeat();\n\t}\n\n\t/** Is the websocket currently open? */\n\tprivate _wsOpen(): boolean {\n\t\treturn !!this._socket && this._socket.readyState === 1;\n\t}\n\n\t/** Send queued messages. */\n\tprivate _sendQueuedMessages(): void {\n\t\t//Create copy of queue and clear it,\n\t\t//because send method push the message back to queue if smth will go wrong\n\t\tconst copiedQueue = [...this._messagesQueue];\n\t\tthis._messagesQueue = [];\n\n\t\tfor (const message of copiedQueue) {\n\t\t\tthis.send(message);\n\t\t}\n\t}\n\n\t/** Exposed send for DC & Peer. */\n\tsend(data: any): void {\n\t\tif (this._disconnected) {\n\t\t\treturn;\n\t\t}\n\n\t\t// If we didn't get an ID yet, we can't yet send anything so we should queue\n\t\t// up these messages.\n\t\tif (!this._id) {\n\t\t\tthis._messagesQueue.push(data);\n\t\t\treturn;\n\t\t}\n\n\t\tif (!data.type) {\n\t\t\tthis.emit(SocketEventType.Error, \"Invalid message\");\n\t\t\treturn;\n\t\t}\n\n\t\tif (!this._wsOpen()) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst message = JSON.stringify(data);\n\n\t\tthis._socket!.send(message);\n\t}\n\n\tclose(): void {\n\t\tif (this._disconnected) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis._cleanup();\n\n\t\tthis._disconnected = true;\n\t}\n\n\tprivate _cleanup(): void {\n\t\tif (this._socket) {\n\t\t\tthis._socket.onopen =\n\t\t\t\tthis._socket.onmessage =\n\t\t\t\tthis._socket.onclose =\n\t\t\t\t\tnull;\n\t\t\tthis._socket.close();\n\t\t\tthis._socket = undefined;\n\t\t}\n\n\t\tclearTimeout(this._wsPingTimer!);\n\t}\n}\n","'use strict';\n\nvar has = Object.prototype.hasOwnProperty\n , prefix = '~';\n\n/**\n * Constructor to create a storage for our `EE` objects.\n * An `Events` instance is a plain object whose properties are event names.\n *\n * @constructor\n * @private\n */\nfunction Events() {}\n\n//\n// We try to not inherit from `Object.prototype`. In some engines creating an\n// instance in this way is faster than calling `Object.create(null)` directly.\n// If `Object.create(null)` is not supported we prefix the event names with a\n// character to make sure that the built-in object properties are not\n// overridden or used as an attack vector.\n//\nif (Object.create) {\n Events.prototype = Object.create(null);\n\n //\n // This hack is needed because the `__proto__` property is still inherited in\n // some old browsers like Android 4, iPhone 5.1, Opera 11 and Safari 5.\n //\n if (!new Events().__proto__) prefix = false;\n}\n\n/**\n * Representation of a single event listener.\n *\n * @param {Function} fn The listener function.\n * @param {*} context The context to invoke the listener with.\n * @param {Boolean} [once=false] Specify if the listener is a one-time listener.\n * @constructor\n * @private\n */\nfunction EE(fn, context, once) {\n this.fn = fn;\n this.context = context;\n this.once = once || false;\n}\n\n/**\n * Add a listener for a given event.\n *\n * @param {EventEmitter} emitter Reference to the `EventEmitter` instance.\n * @param {(String|Symbol)} event The event name.\n * @param {Function} fn The listener function.\n * @param {*} context The context to invoke the listener with.\n * @param {Boolean} once Specify if the listener is a one-time listener.\n * @returns {EventEmitter}\n * @private\n */\nfunction addListener(emitter, event, fn, context, once) {\n if (typeof fn !== 'function') {\n throw new TypeError('The listener must be a function');\n }\n\n var listener = new EE(fn, context || emitter, once)\n , evt = prefix ? prefix + event : event;\n\n if (!emitter._events[evt]) emitter._events[evt] = listener, emitter._eventsCount++;\n else if (!emitter._events[evt].fn) emitter._events[evt].push(listener);\n else emitter._events[evt] = [emitter._events[evt], listener];\n\n return emitter;\n}\n\n/**\n * Clear event by name.\n *\n * @param {EventEmitter} emitter Reference to the `EventEmitter` instance.\n * @param {(String|Symbol)} evt The Event name.\n * @private\n */\nfunction clearEvent(emitter, evt) {\n if (--emitter._eventsCount === 0) emitter._events = new Events();\n else delete emitter._events[evt];\n}\n\n/**\n * Minimal `EventEmitter` interface that is molded against the Node.js\n * `EventEmitter` interface.\n *\n * @constructor\n * @public\n */\nfunction EventEmitter() {\n this._events = new Events();\n this._eventsCount = 0;\n}\n\n/**\n * Return an array listing the events for which the emitter has registered\n * listeners.\n *\n * @returns {Array}\n * @public\n */\nEventEmitter.prototype.eventNames = function eventNames() {\n var names = []\n , events\n , name;\n\n if (this._eventsCount === 0) return names;\n\n for (name in (events = this._events)) {\n if (has.call(events, name)) names.push(prefix ? name.slice(1) : name);\n }\n\n if (Object.getOwnPropertySymbols) {\n return names.concat(Object.getOwnPropertySymbols(events));\n }\n\n return names;\n};\n\n/**\n * Return the listeners registered for a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @returns {Array} The registered listeners.\n * @public\n */\nEventEmitter.prototype.listeners = function listeners(event) {\n var evt = prefix ? prefix + event : event\n , handlers = this._events[evt];\n\n if (!handlers) return [];\n if (handlers.fn) return [handlers.fn];\n\n for (var i = 0, l = handlers.length, ee = new Array(l); i < l; i++) {\n ee[i] = handlers[i].fn;\n }\n\n return ee;\n};\n\n/**\n * Return the number of listeners listening to a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @returns {Number} The number of listeners.\n * @public\n */\nEventEmitter.prototype.listenerCount = function listenerCount(event) {\n var evt = prefix ? prefix + event : event\n , listeners = this._events[evt];\n\n if (!listeners) return 0;\n if (listeners.fn) return 1;\n return listeners.length;\n};\n\n/**\n * Calls each of the listeners registered for a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @returns {Boolean} `true` if the event had listeners, else `false`.\n * @public\n */\nEventEmitter.prototype.emit = function emit(event, a1, a2, a3, a4, a5) {\n var evt = prefix ? prefix + event : event;\n\n if (!this._events[evt]) return false;\n\n var listeners = this._events[evt]\n , len = arguments.length\n , args\n , i;\n\n if (listeners.fn) {\n if (listeners.once) this.removeListener(event, listeners.fn, undefined, true);\n\n switch (len) {\n case 1: return listeners.fn.call(listeners.context), true;\n case 2: return listeners.fn.call(listeners.context, a1), true;\n case 3: return listeners.fn.call(listeners.context, a1, a2), true;\n case 4: return listeners.fn.call(listeners.context, a1, a2, a3), true;\n case 5: return listeners.fn.call(listeners.context, a1, a2, a3, a4), true;\n case 6: return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true;\n }\n\n for (i = 1, args = new Array(len -1); i < len; i++) {\n args[i - 1] = arguments[i];\n }\n\n listeners.fn.apply(listeners.context, args);\n } else {\n var length = listeners.length\n , j;\n\n for (i = 0; i < length; i++) {\n if (listeners[i].once) this.removeListener(event, listeners[i].fn, undefined, true);\n\n switch (len) {\n case 1: listeners[i].fn.call(listeners[i].context); break;\n case 2: listeners[i].fn.call(listeners[i].context, a1); break;\n case 3: listeners[i].fn.call(listeners[i].context, a1, a2); break;\n case 4: listeners[i].fn.call(listeners[i].context, a1, a2, a3); break;\n default:\n if (!args) for (j = 1, args = new Array(len -1); j < len; j++) {\n args[j - 1] = arguments[j];\n }\n\n listeners[i].fn.apply(listeners[i].context, args);\n }\n }\n }\n\n return true;\n};\n\n/**\n * Add a listener for a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @param {Function} fn The listener function.\n * @param {*} [context=this] The context to invoke the listener with.\n * @returns {EventEmitter} `this`.\n * @public\n */\nEventEmitter.prototype.on = function on(event, fn, context) {\n return addListener(this, event, fn, context, false);\n};\n\n/**\n * Add a one-time listener for a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @param {Function} fn The listener function.\n * @param {*} [context=this] The context to invoke the listener with.\n * @returns {EventEmitter} `this`.\n * @public\n */\nEventEmitter.prototype.once = function once(event, fn, context) {\n return addListener(this, event, fn, context, true);\n};\n\n/**\n * Remove the listeners of a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @param {Function} fn Only remove the listeners that match this function.\n * @param {*} context Only remove the listeners that have this context.\n * @param {Boolean} once Only remove one-time listeners.\n * @returns {EventEmitter} `this`.\n * @public\n */\nEventEmitter.prototype.removeListener = function removeListener(event, fn, context, once) {\n var evt = prefix ? prefix + event : event;\n\n if (!this._events[evt]) return this;\n if (!fn) {\n clearEvent(this, evt);\n return this;\n }\n\n var listeners = this._events[evt];\n\n if (listeners.fn) {\n if (\n listeners.fn === fn &&\n (!once || listeners.once) &&\n (!context || listeners.context === context)\n ) {\n clearEvent(this, evt);\n }\n } else {\n for (var i = 0, events = [], length = listeners.length; i < length; i++) {\n if (\n listeners[i].fn !== fn ||\n (once && !listeners[i].once) ||\n (context && listeners[i].context !== context)\n ) {\n events.push(listeners[i]);\n }\n }\n\n //\n // Reset the array, or remove it completely if we have no more listeners.\n //\n if (events.length) this._events[evt] = events.length === 1 ? events[0] : events;\n else clearEvent(this, evt);\n }\n\n return this;\n};\n\n/**\n * Remove all listeners, or those of the specified event.\n *\n * @param {(String|Symbol)} [event] The event name.\n * @returns {EventEmitter} `this`.\n * @public\n */\nEventEmitter.prototype.removeAllListeners = function removeAllListeners(event) {\n var evt;\n\n if (event) {\n evt = prefix ? prefix + event : event;\n if (this._events[evt]) clearEvent(this, evt);\n } else {\n this._events = new Events();\n this._eventsCount = 0;\n }\n\n return this;\n};\n\n//\n// Alias methods names because people roll like that.\n//\nEventEmitter.prototype.off = EventEmitter.prototype.removeListener;\nEventEmitter.prototype.addListener = EventEmitter.prototype.on;\n\n//\n// Expose the prefix.\n//\nEventEmitter.prefixed = prefix;\n\n//\n// Allow `EventEmitter` to be imported as module namespace.\n//\nEventEmitter.EventEmitter = EventEmitter;\n\n//\n// Expose the module.\n//\nif ('undefined' !== typeof module) {\n module.exports = EventEmitter;\n}\n","export enum ConnectionType {\n\tData = \"data\",\n\tMedia = \"media\",\n}\n\nexport enum PeerErrorType {\n\t/**\n\t * The client's browser does not support some or all WebRTC features that you are trying to use.\n\t */\n\tBrowserIncompatible = \"browser-incompatible\",\n\t/**\n\t * You've already disconnected this peer from the server and can no longer make any new connections on it.\n\t */\n\tDisconnected = \"disconnected\",\n\t/**\n\t * The ID passed into the Peer constructor contains illegal characters.\n\t */\n\tInvalidID = \"invalid-id\",\n\t/**\n\t * The API key passed into the Peer constructor contains illegal characters or is not in the system (cloud server only).\n\t */\n\tInvalidKey = \"invalid-key\",\n\t/**\n\t * Lost or cannot establish a connection to the signalling server.\n\t */\n\tNetwork = \"network\",\n\t/**\n\t * The peer you're trying to connect to does not exist.\n\t */\n\tPeerUnavailable = \"peer-unavailable\",\n\t/**\n\t * PeerJS is being used securely, but the cloud server does not support SSL. Use a custom PeerServer.\n\t */\n\tSslUnavailable = \"ssl-unavailable\",\n\t/**\n\t * Unable to reach the server.\n\t */\n\tServerError = \"server-error\",\n\t/**\n\t * An error from the underlying socket.\n\t */\n\tSocketError = \"socket-error\",\n\t/**\n\t * The underlying socket closed unexpectedly.\n\t */\n\tSocketClosed = \"socket-closed\",\n\t/**\n\t * The ID passed into the Peer constructor is already taken.\n\t *\n\t * :::caution\n\t * This error is not fatal if your peer has open peer-to-peer connections.\n\t * This can happen if you attempt to {@apilink Peer.reconnect} a peer that has been disconnected from the server,\n\t * but its old ID has now been taken.\n\t * :::\n\t */\n\tUnavailableID = \"unavailable-id\",\n\t/**\n\t * Native WebRTC errors.\n\t */\n\tWebRTC = \"webrtc\",\n}\n\nexport enum BaseConnectionErrorType {\n\tNegotiationFailed = \"negotiation-failed\",\n\tConnectionClosed = \"connection-closed\",\n}\n\nexport enum DataConnectionErrorType {\n\tNotOpenYet = \"not-open-yet\",\n\tMessageToBig = \"message-too-big\",\n}\n\nexport enum SerializationType {\n\tBinary = \"binary\",\n\tBinaryUTF8 = \"binary-utf8\",\n\tJSON = \"json\",\n\tNone = \"raw\",\n}\n\nexport enum SocketEventType {\n\tMessage = \"message\",\n\tDisconnected = \"disconnected\",\n\tError = \"error\",\n\tClose = \"close\",\n}\n\nexport enum ServerMessageType {\n\tHeartbeat = \"HEARTBEAT\",\n\tCandidate = \"CANDIDATE\",\n\tOffer = \"OFFER\",\n\tAnswer = \"ANSWER\",\n\tOpen = \"OPEN\", // The connection to the server is open.\n\tError = \"ERROR\", // Server error.\n\tIdTaken = \"ID-TAKEN\", // The selected ID is taken.\n\tInvalidKey = \"INVALID-KEY\", // The given API key cannot be found.\n\tLeave = \"LEAVE\", // Another peer has closed its connection to this peer.\n\tExpire = \"EXPIRE\", // The offer sent to a peer has expired without response.\n}\n","{\n\t\"name\": \"@s21g/peerjs\",\n\t\"version\": \"1.5.4\",\n\t\"keywords\": [\n\t\t\"peerjs\",\n\t\t\"webrtc\",\n\t\t\"p2p\",\n\t\t\"rtc\"\n\t],\n\t\"description\": \"PeerJS client\",\n\t\"homepage\": \"https://peerjs.com\",\n\t\"bugs\": {\n\t\t\"url\": \"https://github.com/peers/peerjs/issues\"\n\t},\n\t\"repository\": {\n\t\t\"type\": \"git\",\n\t\t\"url\": \"https://github.com/peers/peerjs\"\n\t},\n\t\"license\": \"MIT\",\n\t\"contributors\": [\n\t\t\"Michelle Bu <michelle@michellebu.com>\",\n\t\t\"afrokick <devbyru@gmail.com>\",\n\t\t\"ericz <really.ez@gmail.com>\",\n\t\t\"Jairo <kidandcat@gmail.com>\",\n\t\t\"Jonas Gloning <34194370+jonasgloning@users.noreply.github.com>\",\n\t\t\"Jairo Caro-Accino Viciana <jairo@galax.be>\",\n\t\t\"Carlos Caballero <carlos.caballero.gonzalez@gmail.com>\",\n\t\t\"hc <hheennrryy@gmail.com>\",\n\t\t\"Muhammad Asif <capripio@gmail.com>\",\n\t\t\"PrashoonB <prashoonbhattacharjee@gmail.com>\",\n\t\t\"Harsh Bardhan Mishra <47351025+HarshCasper@users.noreply.github.com>\",\n\t\t\"akotynski <aleksanderkotbury@gmail.com>\",\n\t\t\"lmb <i@lmb.io>\",\n\t\t\"Jairooo <jairocaro@msn.com>\",\n\t\t\"Moritz Stückler <moritz.stueckler@gmail.com>\",\n\t\t\"Simon <crydotsnakegithub@gmail.com>\",\n\t\t\"Denis Lukov <denismassters@gmail.com>\",\n\t\t\"Philipp Hancke <fippo@andyet.net>\",\n\t\t\"Hans Oksendahl <hansoksendahl@gmail.com>\",\n\t\t\"Jess <jessachandler@gmail.com>\",\n\t\t\"khankuan <khankuan@gmail.com>\",\n\t\t\"DUODVK <kurmanov.work@gmail.com>\",\n\t\t\"XiZhao <kwang1imsa@gmail.com>\",\n\t\t\"Matthias Lohr <matthias@lohr.me>\",\n\t\t\"=frank tree <=frnktrb@googlemail.com>\",\n\t\t\"Andre Eckardt <aeckardt@outlook.com>\",\n\t\t\"Chris Cowan <agentme49@gmail.com>\",\n\t\t\"Alex Chuev <alex@chuev.com>\",\n\t\t\"alxnull <alxnull@e.mail.de>\",\n\t\t\"Yemel Jardi <angel.jardi@gmail.com>\",\n\t\t\"Ben Parnell <benjaminparnell.94@gmail.com>\",\n\t\t\"Benny Lichtner <bennlich@gmail.com>\",\n\t\t\"fresheneesz <bitetrudpublic@gmail.com>\",\n\t\t\"bob.barstead@exaptive.com <bob.barstead@exaptive.com>\",\n\t\t\"chandika <chandika@gmail.com>\",\n\t\t\"emersion <contact@emersion.fr>\",\n\t\t\"Christopher Van <cvan@users.noreply.github.com>\",\n\t\t\"eddieherm <edhermoso@gmail.com>\",\n\t\t\"Eduardo Pinho <enet4mikeenet@gmail.com>\",\n\t\t\"Evandro Zanatta <ezanatta@tray.net.br>\",\n\t\t\"Gardner Bickford <gardner@users.noreply.github.com>\",\n\t\t\"Gian Luca <gianluca.cecchi@cynny.com>\",\n\t\t\"PatrickJS <github@gdi2290.com>\",\n\t\t\"jonnyf <github@jonathanfoss.co.uk>\",\n\t\t\"Hizkia Felix <hizkifw@gmail.com>\",\n\t\t\"Hristo Oskov <hristo.oskov@gmail.com>\",\n\t\t\"Isaac Madwed <i.madwed@gmail.com>\",\n\t\t\"Ilya Konanykhin <ilya.konanykhin@gmail.com>\",\n\t\t\"jasonbarry <jasbarry@me.com>\",\n\t\t\"Jonathan Burke <jonathan.burke.1311@googlemail.com>\",\n\t\t\"Josh Hamit <josh.hamit@gmail.com>\",\n\t\t\"Jordan Austin <jrax86@gmail.com>\",\n\t\t\"Joel Wetzell <jwetzell@yahoo.com>\",\n\t\t\"xizhao <kevin.wang@cloudera.com>\",\n\t\t\"Alberto Torres <kungfoobar@gmail.com>\",\n\t\t\"Jonathan Mayol <mayoljonathan@gmail.com>\",\n\t\t\"Jefferson Felix <me@jsfelix.dev>\",\n\t\t\"Rolf Erik Lekang <me@rolflekang.com>\",\n\t\t\"Kevin Mai-Husan Chia <mhchia@users.noreply.github.com>\",\n\t\t\"Pepijn de Vos <pepijndevos@gmail.com>\",\n\t\t\"JooYoung <qkdlql@naver.com>\",\n\t\t\"Tobias Speicher <rootcommander@gmail.com>\",\n\t\t\"Steve Blaurock <sblaurock@gmail.com>\",\n\t\t\"Kyrylo Shegeda <shegeda@ualberta.ca>\",\n\t\t\"Diwank Singh Tomer <singh@diwank.name>\",\n\t\t\"Sören Balko <Soeren.Balko@gmail.com>\",\n\t\t\"Arpit Solanki <solankiarpit1997@gmail.com>\",\n\t\t\"Yuki Ito <yuki@gnnk.net>\",\n\t\t\"Artur Zayats <zag2art@gmail.com>\"\n\t],\n\t\"funding\": {\n\t\t\"type\": \"opencollective\",\n\t\t\"url\": \"https://opencollective.com/peer\"\n\t},\n\t\"collective\": {\n\t\t\"type\": \"opencollective\",\n\t\t\"url\": \"https://opencollective.com/peer\"\n\t},\n\t\"files\": [\n\t\t\"dist/*\"\n\t],\n\t\"sideEffects\": [\n\t\t\"lib/global.ts\",\n\t\t\"lib/supports.ts\"\n\t],\n\t\"main\": \"dist/bundler.cjs\",\n\t\"module\": \"dist/bundler.mjs\",\n\t\"browser-minified\": \"dist/peerjs.min.js\",\n\t\"browser-unminified\": \"dist/peerjs.js\",\n\t\"browser-minified-msgpack\": \"dist/serializer.msgpack.mjs\",\n\t\"types\": \"dist/types.d.ts\",\n\t\"engines\": {\n\t\t\"node\": \">= 14\"\n\t},\n\t\"targets\": {\n\t\t\"types\": {\n\t\t\t\"source\": \"lib/exports.ts\"\n\t\t},\n\t\t\"main\": {\n\t\t\t\"source\": \"lib/exports.ts\",\n\t\t\t\"sourceMap\": {\n\t\t\t\t\"inlineSources\": true\n\t\t\t}\n\t\t},\n\t\t\"module\": {\n\t\t\t\"source\": \"lib/exports.ts\",\n\t\t\t\"includeNodeModules\": [\n\t\t\t\t\"eventemitter3\"\n\t\t\t],\n\t\t\t\"sourceMap\": {\n\t\t\t\t\"inlineSources\": true\n\t\t\t}\n\t\t},\n\t\t\"browser-minified\": {\n\t\t\t\"context\": \"browser\",\n\t\t\t\"outputFormat\": \"global\",\n\t\t\t\"optimize\": true,\n\t\t\t\"engines\": {\n\t\t\t\t\"browsers\": \"chrome >= 83, edge >= 83, firefox >= 80, safari >= 15\"\n\t\t\t},\n\t\t\t\"source\": \"lib/global.ts\"\n\t\t},\n\t\t\"browser-unminified\": {\n\t\t\t\"context\": \"browser\",\n\t\t\t\"outputFormat\": \"global\",\n\t\t\t\"optimize\": false,\n\t\t\t\"engines\": {\n\t\t\t\t\"browsers\": \"chrome >= 83, edge >= 83, firefox >= 80, safari >= 15\"\n\t\t\t},\n\t\t\t\"source\": \"lib/global.ts\"\n\t\t},\n\t\t\"browser-minified-msgpack\": {\n\t\t\t\"context\": \"browser\",\n\t\t\t\"outputFormat\": \"esmodule\",\n\t\t\t\"isLibrary\": true,\n\t\t\t\"optimize\": true,\n\t\t\t\"engines\": {\n\t\t\t\t\"browsers\": \"chrome >= 83, edge >= 83, firefox >= 102, safari >= 15\"\n\t\t\t},\n\t\t\t\"source\": \"lib/dataconnection/StreamConnection/MsgPack.ts\"\n\t\t}\n\t},\n\t\"scripts\": {\n\t\t\"contributors\": \"git-authors-cli --print=false && prettier --write package.json && git add package.json package-lock.json && git commit -m \\\"chore(contributors): update and sort contributors list\\\"\",\n\t\t\"check\": \"tsc --noEmit && tsc -p e2e/tsconfig.json --noEmit\",\n\t\t\"watch\": \"parcel watch\",\n\t\t\"build\": \"rm -rf dist && parcel build\",\n\t\t\"clean\": \"rm -rf .parcel-cache dist\",\n\t\t\"prepublishOnly\": \"npm run build\",\n\t\t\"test\": \"jest\",\n\t\t\"test:watch\": \"jest --watch\",\n\t\t\"coverage\": \"jest --coverage --collectCoverageFrom=\\\"./lib/**\\\"\",\n\t\t\"format\": \"prettier --write .\",\n\t\t\"format:check\": \"prettier --check .\",\n\t\t\"semantic-release\": \"semantic-release\",\n\t\t\"e2e\": \"wdio run e2e/wdio.local.conf.ts\",\n\t\t\"e2e:bstack\": \"wdio run e2e/wdio.bstack.conf.ts\"\n\t},\n\t\"devDependencies\": {\n\t\t\"@jest/globals\": \"^29.7.0\",\n\t\t\"@parcel/config-default\": \"^2.9.3\",\n\t\t\"@parcel/packager-ts\": \"^2.9.3\",\n\t\t\"@parcel/transformer-typescript-tsc\": \"^2.9.3\",\n\t\t\"@parcel/transformer-typescript-types\": \"^2.9.3\",\n\t\t\"@semantic-release/changelog\": \"^6.0.1\",\n\t\t\"@semantic-release/git\": \"^10.0.1\",\n\t\t\"@swc/core\": \"^1.3.27\",\n\t\t\"@swc/jest\": \"^0.2.24\",\n\t\t\"@types/jasmine\": \"^4.3.4\",\n\t\t\"@wdio/browserstack-service\": \"^8.11.2\",\n\t\t\"@wdio/cli\": \"^8.11.2\",\n\t\t\"@wdio/globals\": \"^8.11.2\",\n\t\t\"@wdio/jasmine-framework\": \"^8.11.2\",\n\t\t\"@wdio/local-runner\": \"^8.11.2\",\n\t\t\"@wdio/spec-reporter\": \"^8.11.2\",\n\t\t\"@wdio/types\": \"^8.10.4\",\n\t\t\"http-server\": \"^14.1.1\",\n\t\t\"jest\": \"^29.3.1\",\n\t\t\"jest-environment-jsdom\": \"^29.3.1\",\n\t\t\"mock-socket\": \"^9.0.0\",\n\t\t\"parcel\": \"^2.9.3\",\n\t\t\"prettier\": \"^3.0.0\",\n\t\t\"semantic-release\": \"^23.0.0\",\n\t\t\"ts-node\": \"^10.9.1\",\n\t\t\"typescript\": \"^5.0.0\",\n\t\t\"wdio-geckodriver-service\": \"^5.0.1\"\n\t},\n\t\"dependencies\": {\n\t\t\"@msgpack/msgpack\": \"^2.8.0\",\n\t\t\"eventemitter3\": \"^4.0.7\",\n\t\t\"peerjs-js-binarypack\": \"file:../js-binarypack\",\n\t\t\"webrtc-adapter\": \"^9.0.0\"\n\t},\n\t\"alias\": {\n\t\t\"process\": false,\n\t\t\"buffer\": false\n\t}\n}\n","import { util } from \"./util\";\nimport logger from \"./logger\";\nimport { Negotiator } from \"./negotiator\";\nimport { ConnectionType, ServerMessageType } from \"./enums\";\nimport type { Peer } from \"./peer\";\nimport { BaseConnection, type BaseConnectionEvents } from \"./baseconnection\";\nimport type { ServerMessage } from \"./servermessage\";\nimport type { AnswerOption } from \"./optionInterfaces\";\n\nexport interface MediaConnectionEvents extends BaseConnectionEvents<never> {\n\t/**\n\t * Emitted when a connection to the PeerServer is established.\n\t *\n\t * ```ts\n\t * mediaConnection.on('stream', (stream) => { ... });\n\t * ```\n\t */\n\tstream: (stream: MediaStream) => void;\n\t/**\n\t * Emitted when the auxiliary data channel is established.\n\t * After this event, hanging up will close the connection cleanly on the remote peer.\n\t * @beta\n\t */\n\twillCloseOnRemote: () => void;\n}\n\n/**\n * Wraps WebRTC's media streams.\n * To get one, use {@apilink Peer.call} or listen for the {@apilink PeerEvents | `call`} event.\n */\nexport class MediaConnection extends BaseConnection<MediaConnectionEvents> {\n\tprivate static readonly ID_PREFIX = \"mc_\";\n\treadonly label: string;\n\n\tprivate _negotiator: Negotiator<MediaConnectionEvents, this>;\n\tprivate _localStream: MediaStream;\n\tprivate _remoteStream: MediaStream;\n\n\t/**\n\t * For media connections, this is always 'media'.\n\t */\n\tget type() {\n\t\treturn ConnectionType.Media;\n\t}\n\n\tget localStream(): MediaStream {\n\t\treturn this._localStream;\n\t}\n\n\tget remoteStream(): MediaStream {\n\t\treturn this._remoteStream;\n\t}\n\n\tconstructor(peerId: string, provider: Peer, options: any) {\n\t\tsuper(peerId, provider, options);\n\n\t\tthis._localStream = this.options._stream;\n\t\tthis.connectionId =\n\t\t\tthis.options.connectionId ||\n\t\t\tMediaConnection.ID_PREFIX + util.randomToken();\n\n\t\tthis._negotiator = new Negotiator(this);\n\n\t\tif (this._localStream) {\n\t\t\tthis._negotiator.startConnection({\n\t\t\t\t_stream: this._localStream,\n\t\t\t\toriginator: true,\n\t\t\t});\n\t\t}\n\t}\n\n\t/** Called by the Negotiator when the DataChannel is ready. */\n\toverride _initializeDataChannel(dc: RTCDataChannel): void {\n\t\tthis.dataChannel = dc;\n\n\t\tthis.dataChannel.onopen = () => {\n\t\t\tlogger.log(`DC#${this.connectionId} dc connection success`);\n\t\t\tthis.emit(\"willCloseOnRemote\");\n\t\t};\n\n\t\tthis.dataChannel.onclose = () => {\n\t\t\tlogger.log(`DC#${this.connectionId} dc closed for:`, this.peer);\n\t\t\tthis.close();\n\t\t};\n\t}\n\taddStream(remoteStream) {\n\t\tlogger.log(\"Receiving stream\", remoteStream);\n\n\t\tthis._remoteStream = remoteStream;\n\t\tsuper.emit(\"stream\", remoteStream); // Should we call this `open`?\n\t}\n\n\t/**\n\t * @internal\n\t */\n\thandleMessage(message: ServerMessage): void {\n\t\tconst type = message.type;\n\t\tconst payload = message.payload;\n\n\t\tswitch (message.type) {\n\t\t\tcase ServerMessageType.Answer:\n\t\t\t\t// Forward to negotiator\n\t\t\t\tvoid this._negotiator.handleSDP(type, payload.sdp);\n\t\t\t\tthis._open = true;\n\t\t\t\tbreak;\n\t\t\tcase ServerMessageType.Candidate:\n\t\t\t\tvoid this._negotiator.handleCandidate(payload.candidate);\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tlogger.warn(`Unrecognized message type:${type} from peer:${this.peer}`);\n\t\t\t\tbreak;\n\t\t}\n\t}\n\n\t/**\n * When receiving a {@apilink PeerEvents | `call`} event on a peer, you can call\n * `answer` on the media connection provided by the callback to accept the call\n * and optionally send your own media stream.\n\n *\n * @param stream A WebRTC media stream.\n * @param options\n * @returns\n */\n\tanswer(stream?: MediaStream, options: AnswerOption = {}): void {\n\t\tif (this._localStream) {\n\t\t\tlogger.warn(\n\t\t\t\t\"Local stream already exists on this MediaConnection. Are you answering a call twice?\",\n\t\t\t);\n\t\t\treturn;\n\t\t}\n\n\t\tthis._localStream = stream;\n\n\t\tif (options && options.sdpTransform) {\n\t\t\tthis.options.sdpTransform = options.sdpTransform;\n\t\t}\n\n\t\tthis._negotiator.startConnection({\n\t\t\t...this.options._payload,\n\t\t\t_stream: stream,\n\t\t});\n\t\t// Retrieve lost messages stored because PeerConnection not set up.\n\t\tconst messages = this.provider._getMessages(this.connectionId);\n\n\t\tfor (const message of messages) {\n\t\t\tthis.handleMessage(message);\n\t\t}\n\n\t\tthis._open = true;\n\t}\n\n\t/**\n\t * Exposed functionality for users.\n\t */\n\n\t/**\n\t * Closes the media connection.\n\t */\n\tclose(): void {\n\t\tif (this._negotiator) {\n\t\t\tthis._negotiator.cleanup();\n\t\t\tthis._negotiator = null;\n\t\t}\n\n\t\tthis._localStream = null;\n\t\tthis._remoteStream = null;\n\n\t\tif (this.provider) {\n\t\t\tthis.provider._removeConnection(this);\n\n\t\t\tthis.provider = null;\n\t\t}\n\n\t\tif (this.options && this.options._stream) {\n\t\t\tthis.options._stream = null;\n\t\t}\n\n\t\tif (!this.open) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis._open = false;\n\n\t\tsuper.emit(\"close\");\n\t}\n}\n","import logger from \"./logger\";\nimport type { MediaConnection } from \"./mediaconnection\";\nimport type { DataConnection } from \"./dataconnection/DataConnection\";\nimport {\n\tBaseConnectionErrorType,\n\tConnectionType,\n\tPeerErrorType,\n\tServerMessageType,\n} from \"./enums\";\nimport type { BaseConnection, BaseConnectionEvents } from \"./baseconnection\";\nimport type { ValidEventTypes } from \"eventemitter3\";\n\n/**\n * Manages all negotiations between Peers.\n */\nexport class Negotiator<\n\tEvents extends ValidEventTypes,\n\tConnectionType extends BaseConnection<Events | BaseConnectionEvents>,\n> {\n\tconstructor(readonly connection: ConnectionType) {}\n\n\t/** Returns a PeerConnection object set up correctly (for data, media). */\n\tstartConnection(options: any) {\n\t\tconst peerConnection = this._startPeerConnection();\n\n\t\t// Set the connection's PC.\n\t\tthis.connection.peerConnection = peerConnection;\n\n\t\tif (this.connection.type === ConnectionType.Media && options._stream) {\n\t\t\tthis._addTracksToConnection(options._stream, peerConnection);\n\t\t}\n\n\t\t// What do we need to do now?\n\t\tif (options.originator) {\n\t\t\tconst dataConnection = this.connection;\n\n\t\t\tconst config: RTCDataChannelInit = { ordered: !!options.reliable };\n\n\t\t\tconst dataChannel = peerConnection.createDataChannel(\n\t\t\t\tdataConnection.label,\n\t\t\t\tconfig,\n\t\t\t);\n\t\t\tdataConnection._initializeDataChannel(dataChannel);\n\n\t\t\tvoid this._makeOffer();\n\t\t} else {\n\t\t\tvoid this.handleSDP(\"OFFER\", options.sdp);\n\t\t}\n\t}\n\n\t/** Start a PC. */\n\tprivate _startPeerConnection(): RTCPeerConnection {\n\t\tlogger.log(\"Creating RTCPeerConnection.\");\n\n\t\tconst peerConnection = new RTCPeerConnection(\n\t\t\tthis.connection.provider.options.config,\n\t\t);\n\n\t\tthis._setupListeners(peerConnection);\n\n\t\treturn peerConnection;\n\t}\n\n\t/** Set up various WebRTC listeners. */\n\tprivate _setupListeners(peerConnection: RTCPeerConnection) {\n\t\tconst peerId = this.connection.peer;\n\t\tconst connectionId = this.connection.connectionId;\n\t\tconst connectionType = this.connection.type;\n\t\tconst provider = this.connection.provider;\n\n\t\t// ICE CANDIDATES.\n\t\tlogger.log(\"Listening for ICE candidates.\");\n\n\t\tpeerConnection.onicecandidate = (evt) => {\n\t\t\tif (!evt.candidate || !evt.candidate.candidate) return;\n\n\t\t\tlogger.log(`Received ICE candidates for ${peerId}:`, evt.candidate);\n\n\t\t\tprovider.socket.send({\n\t\t\t\ttype: ServerMessageType.Candidate,\n\t\t\t\tpayload: {\n\t\t\t\t\tcandidate: evt.candidate,\n\t\t\t\t\ttype: connectionType,\n\t\t\t\t\tconnectionId: connectionId,\n\t\t\t\t},\n\t\t\t\tdst: peerId,\n\t\t\t});\n\t\t};\n\n\t\tpeerConnection.oniceconnectionstatechange = () => {\n\t\t\tswitch (peerConnection.iceConnectionState) {\n\t\t\t\tcase \"failed\":\n\t\t\t\t\tlogger.log(\n\t\t\t\t\t\t\"iceConnectionState is failed, closing connections to \" + peerId,\n\t\t\t\t\t);\n\t\t\t\t\tthis.connection.emitError(\n\t\t\t\t\t\tBaseConnectionErrorType.NegotiationFailed,\n\t\t\t\t\t\t\"Negotiation of connection to \" + peerId + \" failed.\",\n\t\t\t\t\t);\n\t\t\t\t\tthis.connection.close();\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"closed\":\n\t\t\t\t\tlogger.log(\n\t\t\t\t\t\t\"iceConnectionState is closed, closing connections to \" + peerId,\n\t\t\t\t\t);\n\t\t\t\t\tthis.connection.emitError(\n\t\t\t\t\t\tBaseConnectionErrorType.ConnectionClosed,\n\t\t\t\t\t\t\"Connection to \" + peerId + \" closed.\",\n\t\t\t\t\t);\n\t\t\t\t\tthis.connection.close();\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"disconnected\":\n\t\t\t\t\tlogger.log(\n\t\t\t\t\t\t\"iceConnectionState changed to disconnected on the connection with \" +\n\t\t\t\t\t\t\tpeerId,\n\t\t\t\t\t);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"completed\":\n\t\t\t\t\tpeerConnection.onicecandidate = () => {};\n\t\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tthis.connection.emit(\n\t\t\t\t\"iceStateChanged\",\n\t\t\t\tpeerConnection.iceConnectionState,\n\t\t\t);\n\t\t};\n\n\t\t// DATACONNECTION.\n\t\tlogger.log(\"Listening for data channel\");\n\t\t// Fired between offer and answer, so options should already be saved\n\t\t// in the options hash.\n\t\tpeerConnection.ondatachannel = (evt) => {\n\t\t\tlogger.log(\"Received data channel\");\n\n\t\t\tconst dataChannel = evt.channel;\n\t\t\tconst connection = <DataConnection>(\n\t\t\t\tprovider.getConnection(peerId, connectionId)\n\t\t\t);\n\n\t\t\tconnection._initializeDataChannel(dataChannel);\n\t\t};\n\n\t\t// MEDIACONNECTION.\n\t\tlogger.log(\"Listening for remote stream\");\n\n\t\tpeerConnection.ontrack = (evt) => {\n\t\t\tlogger.log(\"Received remote stream\");\n\n\t\t\tconst stream = evt.streams[0];\n\t\t\tconst connection = provider.getConnection(peerId, connectionId);\n\n\t\t\tif (connection.type === ConnectionType.Media) {\n\t\t\t\tconst mediaConnection = <MediaConnection>connection;\n\n\t\t\t\tthis._addStreamToMediaConnection(stream, mediaConnection);\n\t\t\t}\n\t\t};\n\t}\n\n\tcleanup(): void {\n\t\tlogger.log(\"Cleaning up PeerConnection to \" + this.connection.peer);\n\n\t\tconst peerConnection = this.connection.peerConnection;\n\n\t\tif (!peerConnection) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.connection.peerConnection = null;\n\n\t\t//unsubscribe from all PeerConnection's events\n\t\tpeerConnection.onicecandidate =\n\t\t\tpeerConnection.oniceconnectionstatechange =\n\t\t\tpeerConnection.ondatachannel =\n\t\t\tpeerConnection.ontrack =\n\t\t\t\t() => {};\n\n\t\tconst peerConnectionNotClosed = peerConnection.signalingState !== \"closed\";\n\t\tlet dataChannelNotClosed = false;\n\n\t\tconst dataChannel = this.connection.dataChannel;\n\n\t\tif (dataChannel) {\n\t\t\tdataChannelNotClosed =\n\t\t\t\t!!dataChannel.readyState && dataChannel.readyState !== \"closed\";\n\t\t}\n\n\t\tif (peerConnectionNotClosed || dataChannelNotClosed) {\n\t\t\tpeerConnection.close();\n\t\t}\n\t}\n\n\tprivate async _makeOffer(): Promise<void> {\n\t\tconst peerConnection = this.connection.peerConnection;\n\t\tconst provider = this.connection.provider;\n\n\t\ttry {\n\t\t\tconst offer = await peerConnection.createOffer(\n\t\t\t\tthis.connection.options.constraints,\n\t\t\t);\n\n\t\t\tlogger.log(\"Created offer.\");\n\n\t\t\tif (\n\t\t\t\tthis.connection.options.sdpTransform &&\n\t\t\t\ttypeof this.connection.options.sdpTransform === \"function\"\n\t\t\t) {\n\t\t\t\toffer.sdp =\n\t\t\t\t\tthis.connection.options.sdpTransform(offer.sdp) || offer.sdp;\n\t\t\t}\n\n\t\t\ttry {\n\t\t\t\tawait peerConnection.setLocalDescription(offer);\n\n\t\t\t\tlogger.log(\n\t\t\t\t\t\"Set localDescription:\",\n\t\t\t\t\toffer,\n\t\t\t\t\t`for:${this.connection.peer}`,\n\t\t\t\t);\n\n\t\t\t\tlet payload: any = {\n\t\t\t\t\tsdp: offer,\n\t\t\t\t\ttype: this.connection.type,\n\t\t\t\t\tconnectionId: this.connection.connectionId,\n\t\t\t\t\tmetadata: this.connection.metadata,\n\t\t\t\t};\n\n\t\t\t\tif (this.connection.type === ConnectionType.Data) {\n\t\t\t\t\tconst dataConnection = <DataConnection>(<unknown>this.connection);\n\n\t\t\t\t\tpayload = {\n\t\t\t\t\t\t...payload,\n\t\t\t\t\t\tlabel: dataConnection.label,\n\t\t\t\t\t\treliable: dataConnection.reliable,\n\t\t\t\t\t\tserialization: dataConnection.serialization,\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\tprovider.socket.send({\n\t\t\t\t\ttype: ServerMessageType.Offer,\n\t\t\t\t\tpayload,\n\t\t\t\t\tdst: this.connection.peer,\n\t\t\t\t});\n\t\t\t} catch (err) {\n\t\t\t\t// TODO: investigate why _makeOffer is being called from the answer\n\t\t\t\tif (\n\t\t\t\t\terr !=\n\t\t\t\t\t\"OperationError: Failed to set local offer sdp: Called in wrong state: kHaveRemoteOffer\"\n\t\t\t\t) {\n\t\t\t\t\tprovider.emitError(PeerErrorType.WebRTC, err);\n\t\t\t\t\tlogger.log(\"Failed to setLocalDescription, \", err);\n\t\t\t\t}\n\t\t\t}\n\t\t} catch (err_1) {\n\t\t\tprovider.emitError(PeerErrorType.WebRTC, err_1);\n\t\t\tlogger.log(\"Failed to createOffer, \", err_1);\n\t\t}\n\t}\n\n\tprivate async _makeAnswer(): Promise<void> {\n\t\tconst peerConnection = this.connection.peerConnection;\n\t\tconst provider = this.connection.provider;\n\n\t\ttry {\n\t\t\tconst answer = await peerConnection.createAnswer();\n\t\t\tlogger.log(\"Created answer.\");\n\n\t\t\tif (\n\t\t\t\tthis.connection.options.sdpTransform &&\n\t\t\t\ttypeof this.connection.options.sdpTransform === \"function\"\n\t\t\t) {\n\t\t\t\tanswer.sdp =\n\t\t\t\t\tthis.connection.options.sdpTransform(answer.sdp) || answer.sdp;\n\t\t\t}\n\n\t\t\ttry {\n\t\t\t\tawait peerConnection.setLocalDescription(answer);\n\n\t\t\t\tlogger.log(\n\t\t\t\t\t`Set localDescription:`,\n\t\t\t\t\tanswer,\n\t\t\t\t\t`for:${this.connection.peer}`,\n\t\t\t\t);\n\n\t\t\t\tprovider.socket.send({\n\t\t\t\t\ttype: ServerMessageType.Answer,\n\t\t\t\t\tpayload: {\n\t\t\t\t\t\tsdp: answer,\n\t\t\t\t\t\ttype: this.connection.type,\n\t\t\t\t\t\tconnectionId: this.connection.connectionId,\n\t\t\t\t\t},\n\t\t\t\t\tdst: this.connection.peer,\n\t\t\t\t});\n\t\t\t} catch (err) {\n\t\t\t\tprovider.emitError(PeerErrorType.WebRTC, err);\n\t\t\t\tlogger.log(\"Failed to setLocalDescription, \", err);\n\t\t\t}\n\t\t} catch (err_1) {\n\t\t\tprovider.emitError(PeerErrorType.WebRTC, err_1);\n\t\t\tlogger.log(\"Failed to create answer, \", err_1);\n\t\t}\n\t}\n\n\t/** Handle an SDP. */\n\tasync handleSDP(type: string, sdp: any): Promise<void> {\n\t\tsdp = new RTCSessionDescription(sdp);\n\t\tconst peerConnection = this.connection.peerConnection;\n\t\tconst provider = this.connection.provider;\n\n\t\tlogger.log(\"Setting remote description\", sdp);\n\n\t\tconst self = this;\n\n\t\ttry {\n\t\t\tawait peerConnection.setRemoteDescription(sdp);\n\t\t\tlogger.log(`Set remoteDescription:${type} for:${this.connection.peer}`);\n\t\t\tif (type === \"OFFER\") {\n\t\t\t\tawait self._makeAnswer();\n\t\t\t}\n\t\t} catch (err) {\n\t\t\tprovider.emitError(PeerErrorType.WebRTC, err);\n\t\t\tlogger.log(\"Failed to setRemoteDescription, \", err);\n\t\t}\n\t}\n\n\t/** Handle a candidate. */\n\tasync handleCandidate(ice: RTCIceCandidate) {\n\t\tlogger.log(`handleCandidate:`, ice);\n\n\t\ttry {\n\t\t\tawait this.connection.peerConnection.addIceCandidate(ice);\n\t\t\tlogger.log(`Added ICE candidate for:${this.connection.peer}`);\n\t\t} catch (err) {\n\t\t\tthis.connection.provider.emitError(PeerErrorType.WebRTC, err);\n\t\t\tlogger.log(\"Failed to handleCandidate, \", err);\n\t\t}\n\t}\n\n\tprivate _addTracksToConnection(\n\t\tstream: MediaStream,\n\t\tpeerConnection: RTCPeerConnection,\n\t): void {\n\t\tlogger.log(`add tracks from stream ${stream.id} to peer connection`);\n\n\t\tif (!peerConnection.addTrack) {\n\t\t\treturn logger.error(\n\t\t\t\t`Your browser does't support RTCPeerConnection#addTrack. Ignored.`,\n\t\t\t);\n\t\t}\n\n\t\tstream.getTracks().forEach((track) => {\n\t\t\tpeerConnection.addTrack(track, stream);\n\t\t});\n\t}\n\n\tprivate _addStreamToMediaConnection(\n\t\tstream: MediaStream,\n\t\tmediaConnection: MediaConnection,\n\t): void {\n\t\tlogger.log(\n\t\t\t`add stream ${stream.id} to media connection ${mediaConnection.connectionId}`,\n\t\t);\n\n\t\tmediaConnection.addStream(stream);\n\t}\n}\n","import type { Peer } from \"./peer\";\nimport type { ServerMessage } from \"./servermessage\";\nimport type { ConnectionType } from \"./enums\";\nimport { BaseConnectionErrorType } from \"./enums\";\nimport {\n\tEventEmitterWithError,\n\ttype EventsWithError,\n\tPeerError,\n} from \"./peerError\";\nimport type { ValidEventTypes } from \"eventemitter3\";\n\nexport interface BaseConnectionEvents<\n\tErrorType extends string = BaseConnectionErrorType,\n> extends EventsWithError<ErrorType> {\n\t/**\n\t * Emitted when either you or the remote peer closes the connection.\n\t *\n\t * ```ts\n\t * connection.on('close', () => { ... });\n\t * ```\n\t */\n\tclose: () => void;\n\t/**\n\t * ```ts\n\t * connection.on('error', (error) => { ... });\n\t * ```\n\t */\n\terror: (error: PeerError<`${ErrorType}`>) => void;\n\ticeStateChanged: (state: RTCIceConnectionState) => void;\n}\n\nexport abstract class BaseConnection<\n\tSubClassEvents extends ValidEventTypes,\n\tErrorType extends string = never,\n> extends EventEmitterWithError<\n\tErrorType | BaseConnectionErrorType,\n\tSubClassEvents & BaseConnectionEvents<BaseConnectionErrorType | ErrorType>\n> {\n\tprotected _open = false;\n\n\t/**\n\t * Any type of metadata associated with the connection,\n\t * passed in by whoever initiated the connection.\n\t */\n\treadonly metadata: any;\n\tconnectionId: string;\n\n\tpeerConnection: RTCPeerConnection;\n\tdataChannel: RTCDataChannel;\n\n\tabstract get type(): ConnectionType;\n\n\t/**\n\t * The optional label passed in or assigned by PeerJS when the connection was initiated.\n\t */\n\tlabel: string;\n\n\t/**\n\t * Whether the media connection is active (e.g. your call has been answered).\n\t * You can check this if you want to set a maximum wait time for a one-sided call.\n\t */\n\tget open() {\n\t\treturn this._open;\n\t}\n\n\tprotected constructor(\n\t\t/**\n\t\t * The ID of the peer on the other end of this connection.\n\t\t */\n\t\treadonly peer: string,\n\t\tpublic provider: Peer,\n\t\treadonly options: any,\n\t) {\n\t\tsuper();\n\n\t\tthis.metadata = options.metadata;\n\t}\n\n\tabstract close(): void;\n\n\t/**\n\t * @internal\n\t */\n\tabstract handleMessage(message: ServerMessage): void;\n\n\t/**\n\t * Called by the Negotiator when the DataChannel is ready.\n\t * @internal\n\t * */\n\tabstract _initializeDataChannel(dc: RTCDataChannel): void;\n}\n","import { EventEmitter } from \"eventemitter3\";\nimport logger from \"./logger\";\n\nexport interface EventsWithError<ErrorType extends string> {\n\terror: (error: PeerError<`${ErrorType}`>) => void;\n}\n\nexport class EventEmitterWithError<\n\tErrorType extends string,\n\tEvents extends EventsWithError<ErrorType>,\n> extends EventEmitter<Events, never> {\n\t/**\n\t * Emits a typed error message.\n\t *\n\t * @internal\n\t */\n\temitError(type: ErrorType, err: string | Error): void {\n\t\tlogger.error(\"Error:\", err);\n\n\t\t// @ts-ignore\n\t\tthis.emit(\"error\", new PeerError<`${ErrorType}`>(`${type}`, err));\n\t}\n}\n/**\n * A PeerError is emitted whenever an error occurs.\n * It always has a `.type`, which can be used to identify the error.\n */\nexport class PeerError<T extends string> extends Error {\n\t/**\n\t * @internal\n\t */\n\tconstructor(type: T, err: Error | string) {\n\t\tif (typeof err === \"string\") {\n\t\t\tsuper(err);\n\t\t} else {\n\t\t\tsuper();\n\t\t\tObject.assign(this, err);\n\t\t}\n\n\t\tthis.type = type;\n\t}\n\n\tpublic type: T;\n}\n","import { util } from \"./util\";\nimport logger from \"./logger\";\nimport type { PeerJSOption } from \"./optionInterfaces\";\nimport { version } from \"../package.json\";\n\nexport class API {\n\tconstructor(private readonly _options: PeerJSOption) {}\n\n\tprivate _buildRequest(method: string): Promise<Response> {\n\t\tconst protocol = this._options.secure ? \"https\" : \"http\";\n\t\tconst { host, port, path, key } = this._options;\n\t\tconst url = new URL(`${protocol}://${host}:${port}${path}${key}/${method}`);\n\t\t// TODO: Why timestamp, why random?\n\t\turl.searchParams.set(\"ts\", `${Date.now()}${Math.random()}`);\n\t\turl.searchParams.set(\"version\", version);\n\t\treturn fetch(url.href, {\n\t\t\treferrerPolicy: this._options.referrerPolicy,\n\t\t});\n\t}\n\n\t/** Get a unique ID from the server via XHR and initialize with it. */\n\tasync retrieveId(): Promise<string> {\n\t\ttry {\n\t\t\tconst response = await this._buildRequest(\"id\");\n\n\t\t\tif (response.status !== 200) {\n\t\t\t\tthrow new Error(`Error. Status:${response.status}`);\n\t\t\t}\n\n\t\t\treturn response.text();\n\t\t} catch (error) {\n\t\t\tlogger.error(\"Error retrieving ID\", error);\n\n\t\t\tlet pathError = \"\";\n\n\t\t\tif (\n\t\t\t\tthis._options.path === \"/\" &&\n\t\t\t\tthis._options.host !== util.CLOUD_HOST\n\t\t\t) {\n\t\t\t\tpathError =\n\t\t\t\t\t\" If you passed in a `path` to your self-hosted PeerServer, \" +\n\t\t\t\t\t\"you'll also need to pass in that same path when creating a new \" +\n\t\t\t\t\t\"Peer.\";\n\t\t\t}\n\n\t\t\tthrow new Error(\"Could not get an ID from the server.\" + pathError);\n\t\t}\n\t}\n\n\t/** @deprecated */\n\tasync listAllPeers(): Promise<any[]> {\n\t\ttry {\n\t\t\tconst response = await this._buildRequest(\"peers\");\n\n\t\t\tif (response.status !== 200) {\n\t\t\t\tif (response.status === 401) {\n\t\t\t\t\tlet helpfulError = \"\";\n\n\t\t\t\t\tif (this._options.host === util.CLOUD_HOST) {\n\t\t\t\t\t\thelpfulError =\n\t\t\t\t\t\t\t\"It looks like you're using the cloud server. You can email \" +\n\t\t\t\t\t\t\t\"team@peerjs.com to enable peer listing for your API key.\";\n\t\t\t\t\t} else {\n\t\t\t\t\t\thelpfulError =\n\t\t\t\t\t\t\t\"You need to enable `allow_discovery` on your self-hosted \" +\n\t\t\t\t\t\t\t\"PeerServer to use this feature.\";\n\t\t\t\t\t}\n\n\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t\"It doesn't look like you have permission to list peers IDs. \" +\n\t\t\t\t\t\t\thelpfulError,\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\tthrow new Error(`Error. Status:${response.status}`);\n\t\t\t}\n\n\t\t\treturn response.json();\n\t\t} catch (error) {\n\t\t\tlogger.error(\"Error retrieving list peers\", error);\n\n\t\t\tthrow new Error(\"Could not get list peers from the server.\" + error);\n\t\t}\n\t}\n}\n","import { BinaryPackChunker, concatArrayBuffers } from \"./binaryPackChunker\";\nimport logger from \"../../logger\";\nimport type { Peer } from \"../../peer\";\nimport { BufferedConnection } from \"./BufferedConnection\";\nimport { SerializationType } from \"../../enums\";\nimport { pack, type Packable, unpack } from \"peerjs-js-binarypack\";\n\nexport class BinaryPack extends BufferedConnection {\n\tprivate readonly chunker = new BinaryPackChunker();\n\treadonly serialization = SerializationType.Binary;\n\n\tprivate _chunkedData: {\n\t\t[id: number]: {\n\t\t\tdata: Uint8Array[];\n\t\t\tcount: number;\n\t\t\ttotal: number;\n\t\t};\n\t} = {};\n\n\tpublic override close(options?: { flush?: boolean }) {\n\t\tsuper.close(options);\n\t\tthis._chunkedData = {};\n\t}\n\n\tconstructor(peerId: string, provider: Peer, options: any) {\n\t\tsuper(peerId, provider, options);\n\t}\n\n\t// Handles a DataChannel message.\n\tprotected override _handleDataMessage({ data }: { data: Uint8Array }): void {\n\t\tconst deserializedData = unpack(data);\n\n\t\t// PeerJS specific message\n\t\tconst peerData = deserializedData[\"__peerData\"];\n\t\tif (peerData) {\n\t\t\tif (peerData.type === \"close\") {\n\t\t\t\tthis.close();\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Chunked data -- piece things back together.\n\t\t\t// @ts-ignore\n\t\t\tthis._handleChunk(deserializedData);\n\t\t\treturn;\n\t\t}\n\n\t\tthis.emit(\"data\", deserializedData);\n\t}\n\n\tprivate _handleChunk(data: {\n\t\t__peerData: number;\n\t\tn: number;\n\t\ttotal: number;\n\t\tdata: ArrayBuffer;\n\t}): void {\n\t\tconst id = data.__peerData;\n\t\tconst chunkInfo = this._chunkedData[id] || {\n\t\t\tdata: [],\n\t\t\tcount: 0,\n\t\t\ttotal: data.total,\n\t\t};\n\n\t\tchunkInfo.data[data.n] = new Uint8Array(data.data);\n\t\tchunkInfo.count++;\n\t\tthis._chunkedData[id] = chunkInfo;\n\n\t\tif (chunkInfo.total === chunkInfo.count) {\n\t\t\t// Clean up before making the recursive call to `_handleDataMessage`.\n\t\t\tdelete this._chunkedData[id];\n\n\t\t\t// We've received all the chunks--time to construct the complete data.\n\t\t\t// const data = new Blob(chunkInfo.data);\n\t\t\tconst data = concatArrayBuffers(chunkInfo.data);\n\t\t\tthis._handleDataMessage({ data });\n\t\t}\n\t}\n\n\tprotected override _send(data: Packable, chunked: boolean) {\n\t\tconst blob = pack(data);\n\t\tif (blob instanceof Promise) {\n\t\t\treturn this._send_blob(blob);\n\t\t}\n\n\t\tif (!chunked && blob.byteLength > this.chunker.chunkedMTU) {\n\t\t\tthis._sendChunks(blob);\n\t\t\treturn;\n\t\t}\n\n\t\tthis._bufferedSend(blob);\n\t}\n\tprivate async _send_blob(blobPromise: Promise<ArrayBufferLike>) {\n\t\tconst blob = await blobPromise;\n\t\tif (blob.byteLength > this.chunker.chunkedMTU) {\n\t\t\tthis._sendChunks(blob);\n\t\t\treturn;\n\t\t}\n\n\t\tthis._bufferedSend(blob);\n\t}\n\n\tprivate _sendChunks(blob: ArrayBuffer) {\n\t\tconst blobs = this.chunker.chunk(blob);\n\t\tlogger.log(`DC#${this.connectionId} Try to send ${blobs.length} chunks...`);\n\n\t\tfor (const blob of blobs) {\n\t\t\tthis.send(blob, true);\n\t\t}\n\t}\n}\n","import logger from \"../../logger\";\nimport { DataConnection } from \"../DataConnection\";\n\nexport abstract class BufferedConnection extends DataConnection {\n\tprivate _buffer: any[] = [];\n\tprivate _bufferSize = 0;\n\tprivate _buffering = false;\n\n\tpublic get bufferSize(): number {\n\t\treturn this._bufferSize;\n\t}\n\n\tpublic override _initializeDataChannel(dc: RTCDataChannel) {\n\t\tsuper._initializeDataChannel(dc);\n\t\tthis.dataChannel.binaryType = \"arraybuffer\";\n\t\tthis.dataChannel.addEventListener(\"message\", (e) =>\n\t\t\tthis._handleDataMessage(e),\n\t\t);\n\t}\n\n\tprotected abstract _handleDataMessage(e: MessageEvent): void;\n\n\tprotected _bufferedSend(msg: ArrayBuffer): void {\n\t\tif (this._buffering || !this._trySend(msg)) {\n\t\t\tthis._buffer.push(msg);\n\t\t\tthis._bufferSize = this._buffer.length;\n\t\t}\n\t}\n\n\t// Returns true if the send succeeds.\n\tprivate _trySend(msg: ArrayBuffer): boolean {\n\t\tif (!this.open) {\n\t\t\treturn false;\n\t\t}\n\n\t\tif (this.dataChannel.bufferedAmount > DataConnection.MAX_BUFFERED_AMOUNT) {\n\t\t\tthis._buffering = true;\n\t\t\tsetTimeout(() => {\n\t\t\t\tthis._buffering = false;\n\t\t\t\tthis._tryBuffer();\n\t\t\t}, 50);\n\n\t\t\treturn false;\n\t\t}\n\n\t\ttry {\n\t\t\tthis.dataChannel.send(msg);\n\t\t} catch (e) {\n\t\t\tlogger.error(`DC#:${this.connectionId} Error when sending:`, e);\n\t\t\tthis._buffering = true;\n\n\t\t\tthis.close();\n\n\t\t\treturn false;\n\t\t}\n\n\t\treturn true;\n\t}\n\n\t// Try to send the first message in the buffer.\n\tprivate _tryBuffer(): void {\n\t\tif (!this.open) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (this._buffer.length === 0) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst msg = this._buffer[0];\n\n\t\tif (this._trySend(msg)) {\n\t\t\tthis._buffer.shift();\n\t\t\tthis._bufferSize = this._buffer.length;\n\t\t\tthis._tryBuffer();\n\t\t}\n\t}\n\n\tpublic override close(options?: { flush?: boolean }) {\n\t\tif (options?.flush) {\n\t\t\tthis.send({\n\t\t\t\t__peerData: {\n\t\t\t\t\ttype: \"close\",\n\t\t\t\t},\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\t\tthis._buffer = [];\n\t\tthis._bufferSize = 0;\n\t\tsuper.close();\n\t}\n}\n","import logger from \"../logger\";\nimport { Negotiator } from \"../negotiator\";\nimport {\n\tBaseConnectionErrorType,\n\tConnectionType,\n\tDataConnectionErrorType,\n\tServerMessageType,\n} from \"../enums\";\nimport type { Peer } from \"../peer\";\nimport { BaseConnection, type BaseConnectionEvents } from \"../baseconnection\";\nimport type { ServerMessage } from \"../servermessage\";\nimport type { EventsWithError } from \"../peerError\";\nimport { randomToken } from \"../utils/randomToken\";\n\nexport interface DataConnectionEvents\n\textends EventsWithError<DataConnectionErrorType | BaseConnectionErrorType>,\n\t\tBaseConnectionEvents<DataConnectionErrorType | BaseConnectionErrorType> {\n\t/**\n\t * Emitted when data is received from the remote peer.\n\t */\n\tdata: (data: unknown) => void;\n\t/**\n\t * Emitted when the connection is established and ready-to-use.\n\t */\n\topen: () => void;\n}\n\n/**\n * Wraps a DataChannel between two Peers.\n */\nexport abstract class DataConnection extends BaseConnection<\n\tDataConnectionEvents,\n\tDataConnectionErrorType\n> {\n\tprotected static readonly ID_PREFIX = \"dc_\";\n\tprotected static readonly MAX_BUFFERED_AMOUNT = 8 * 1024 * 1024;\n\n\tprivate _negotiator: Negotiator<DataConnectionEvents, this>;\n\tabstract readonly serialization: string;\n\treadonly reliable: boolean;\n\n\tpublic get type() {\n\t\treturn ConnectionType.Data;\n\t}\n\n\tconstructor(peerId: string, provider: Peer, options: any) {\n\t\tsuper(peerId, provider, options);\n\n\t\tthis.connectionId =\n\t\t\tthis.options.connectionId || DataConnection.ID_PREFIX + randomToken();\n\n\t\tthis.label = this.options.label || this.connectionId;\n\t\tthis.reliable = !!this.options.reliable;\n\n\t\tthis._negotiator = new Negotiator(this);\n\n\t\tthis._negotiator.startConnection(\n\t\t\tthis.options._payload || {\n\t\t\t\toriginator: true,\n\t\t\t\treliable: this.reliable,\n\t\t\t},\n\t\t);\n\t}\n\n\t/** Called by the Negotiator when the DataChannel is ready. */\n\toverride _initializeDataChannel(dc: RTCDataChannel): void {\n\t\tthis.dataChannel = dc;\n\n\t\tthis.dataChannel.onopen = () => {\n\t\t\tlogger.log(`DC#${this.connectionId} dc connection success`);\n\t\t\tthis._open = true;\n\t\t\tthis.emit(\"open\");\n\t\t};\n\n\t\tthis.dataChannel.onmessage = (e) => {\n\t\t\tlogger.log(`DC#${this.connectionId} dc onmessage:`, e.data);\n\t\t\t// this._handleDataMessage(e);\n\t\t};\n\n\t\tthis.dataChannel.onclose = () => {\n\t\t\tlogger.log(`DC#${this.connectionId} dc closed for:`, this.peer);\n\t\t\tthis.close();\n\t\t};\n\t}\n\n\t/**\n\t * Exposed functionality for users.\n\t */\n\n\t/** Allows user to close connection. */\n\tclose(options?: { flush?: boolean }): void {\n\t\tif (options?.flush) {\n\t\t\tthis.send({\n\t\t\t\t__peerData: {\n\t\t\t\t\ttype: \"close\",\n\t\t\t\t},\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\t\tif (this._negotiator) {\n\t\t\tthis._negotiator.cleanup();\n\t\t\tthis._negotiator = null;\n\t\t}\n\n\t\tif (this.provider) {\n\t\t\tthis.provider._removeConnection(this);\n\n\t\t\tthis.provider = null;\n\t\t}\n\n\t\tif (this.dataChannel) {\n\t\t\tthis.dataChannel.onopen = null;\n\t\t\tthis.dataChannel.onmessage = null;\n\t\t\tthis.dataChannel.onclose = null;\n\t\t\tthis.dataChannel = null;\n\t\t}\n\n\t\tif (!this.open) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis._open = false;\n\n\t\tsuper.emit(\"close\");\n\t}\n\n\tprotected abstract _send(data: any, chunked: boolean): void | Promise<void>;\n\n\t/** Allows user to send data. */\n\tpublic send(data: any, chunked = false) {\n\t\tif (!this.open) {\n\t\t\tthis.emitError(\n\t\t\t\tDataConnectionErrorType.NotOpenYet,\n\t\t\t\t\"Connection is not open. You should listen for the `open` event before sending messages.\",\n\t\t\t);\n\t\t\treturn;\n\t\t}\n\t\treturn this._send(data, chunked);\n\t}\n\n\tasync handleMessage(message: ServerMessage) {\n\t\tconst payload = message.payload;\n\n\t\tswitch (message.type) {\n\t\t\tcase ServerMessageType.Answer:\n\t\t\t\tawait this._negotiator.handleSDP(message.type, payload.sdp);\n\t\t\t\tbreak;\n\t\t\tcase ServerMessageType.Candidate:\n\t\t\t\tawait this._negotiator.handleCandidate(payload.candidate);\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tlogger.warn(\n\t\t\t\t\t\"Unrecognized message type:\",\n\t\t\t\t\tmessage.type,\n\t\t\t\t\t\"from peer:\",\n\t\t\t\t\tthis.peer,\n\t\t\t\t);\n\t\t\t\tbreak;\n\t\t}\n\t}\n}\n","import { BufferedConnection } from \"./BufferedConnection\";\nimport { SerializationType } from \"../../enums\";\n\nexport class Raw extends BufferedConnection {\n\treadonly serialization = SerializationType.None;\n\n\tprotected _handleDataMessage({ data }) {\n\t\tsuper.emit(\"data\", data);\n\t}\n\n\toverride _send(data, _chunked) {\n\t\tthis._bufferedSend(data);\n\t}\n}\n","import { BufferedConnection } from \"./BufferedConnection\";\nimport { DataConnectionErrorType, SerializationType } from \"../../enums\";\nimport { util } from \"../../util\";\n\nexport class Json extends BufferedConnection {\n\treadonly serialization = SerializationType.JSON;\n\tprivate readonly encoder = new TextEncoder();\n\tprivate readonly decoder = new TextDecoder();\n\n\tstringify: (data: any) => string = JSON.stringify;\n\tparse: (data: string) => any = JSON.parse;\n\n\t// Handles a DataChannel message.\n\tprotected override _handleDataMessage({ data }: { data: Uint8Array }): void {\n\t\tconst deserializedData = this.parse(this.decoder.decode(data));\n\n\t\t// PeerJS specific message\n\t\tconst peerData = deserializedData[\"__peerData\"];\n\t\tif (peerData && peerData.type === \"close\") {\n\t\t\tthis.close();\n\t\t\treturn;\n\t\t}\n\n\t\tthis.emit(\"data\", deserializedData);\n\t}\n\n\toverride _send(data, _chunked) {\n\t\tconst encodedData = this.encoder.encode(this.stringify(data));\n\t\tif (encodedData.byteLength >= util.chunkedMTU) {\n\t\t\tthis.emitError(\n\t\t\t\tDataConnectionErrorType.MessageToBig,\n\t\t\t\t\"Message too big for JSON channel\",\n\t\t\t);\n\t\t\treturn;\n\t\t}\n\t\tthis._bufferedSend(encodedData);\n\t}\n}\n","import { Peer, type SerializerMapping } from \"./peer\";\nimport { MsgPack } from \"./exports\";\n\n/**\n * @experimental\n */\nexport class MsgPackPeer extends Peer {\n\toverride _serializers: SerializerMapping = {\n\t\tMsgPack,\n\t\tdefault: MsgPack,\n\t};\n}\n","import { decodeMultiStream, Encoder } from \"@msgpack/msgpack\";\nimport { StreamConnection } from \"./StreamConnection.js\";\nimport type { Peer } from \"../../peer.js\";\n\nexport class MsgPack extends StreamConnection {\n\treadonly serialization = \"MsgPack\";\n // null を無視するために true を渡す\n\tprivate _encoder = new Encoder(\n undefined, undefined, undefined, undefined, undefined, undefined, true);\n\n\tconstructor(peerId: string, provider: Peer, options: any) {\n\t\tsuper(peerId, provider, options);\n\n\t\t(async () => {\n\t\t\tfor await (const msg of decodeMultiStream(this._rawReadStream)) {\n\t\t\t\t// @ts-ignore\n\t\t\t\tif (msg.__peerData?.type === \"close\") {\n\t\t\t\t\tthis.close();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tthis.emit(\"data\", msg);\n\t\t\t}\n\t\t})();\n\t}\n\n\tprotected override _send(data) {\n\t\treturn this.writer.write(this._encoder.encode(data));\n\t}\n}\n","import logger from \"../../logger.js\";\nimport type { Peer } from \"../../peer.js\";\nimport { DataConnection } from \"../DataConnection.js\";\n\nexport abstract class StreamConnection extends DataConnection {\n private onDataChannelOpen: () => void;\n\tprivate _CHUNK_SIZE = 1024 * 8 * 4;\n\tprivate _splitStream = new TransformStream<Uint8Array>({\n\t\ttransform: (chunk, controller) => {\n\t\t\tfor (let split = 0; split < chunk.length; split += this._CHUNK_SIZE) {\n\t\t\t\tcontroller.enqueue(chunk.subarray(split, split + this._CHUNK_SIZE));\n\t\t\t}\n\t\t},\n\t});\n\tprivate _rawSendStream = new WritableStream<ArrayBuffer>({\n\t\twrite: async (chunk, controller) => {\n if (!this.dataChannel || this.dataChannel.readyState !== \"open\") {\n await new Promise<void>((resolve) => {\n this.onDataChannelOpen = resolve;\n });\n }\n\t\t\tconst openEvent = new Promise((resolve) =>\n\t\t\t\tthis.dataChannel.addEventListener(\"bufferedamountlow\", resolve, {\n\t\t\t\t\tonce: true,\n\t\t\t\t}),\n\t\t\t);\n\n\t\t\t// if we can send the chunk now, send it\n\t\t\t// if not, we wait until at least half of the sending buffer is free again\n\t\t\tawait (this.dataChannel.bufferedAmount <=\n\t\t\t\tDataConnection.MAX_BUFFERED_AMOUNT - chunk.byteLength || openEvent);\n\n\t\t\t// TODO: what can go wrong here?\n\t\t\ttry {\n\t\t\t\tthis.dataChannel.send(chunk);\n\t\t\t} catch (e) {\n\t\t\t\tlogger.error(`DC#:${this.connectionId} Error when sending:`, e);\n\t\t\t\tcontroller.error(e);\n\t\t\t\tthis.close();\n\t\t\t}\n\t\t},\n\t});\n\tprotected writer = this._splitStream.writable.getWriter();\n\n\tprotected _rawReadStream = new ReadableStream<ArrayBuffer>({\n\t\tstart: (controller) => {\n\t\t\tthis.once(\"open\", () => {\n\t\t\t\tthis.dataChannel.addEventListener(\"message\", (e) => {\n\t\t\t\t\tcontroller.enqueue(e.data);\n\t\t\t\t});\n\t\t\t});\n\t\t},\n\t});\n\n\tprotected constructor(peerId: string, provider: Peer, options: any) {\n\t\tsuper(peerId, provider, { ...options, reliable: true });\n\n\t\tvoid this._splitStream.readable.pipeTo(this._rawSendStream);\n\t}\n\n\tpublic override _initializeDataChannel(dc) {\n\t\tsuper._initializeDataChannel(dc);\n if (this.onDataChannelOpen) {\n dc.on(\"readystatechange\", () => {\n if (dc.readyState === \"open\") {\n this.onDataChannelOpen();\n }\n });\n }\n\t\tthis.dataChannel.binaryType = \"arraybuffer\";\n\t\tthis.dataChannel.bufferedAmountLowThreshold =\n\t\t\tDataConnection.MAX_BUFFERED_AMOUNT / 2;\n\t}\n}\n"],"names":[],"version":3,"file":"bundler.mjs.map"}
|