From 6b42c2400fbdf7a94b2cfbbd2c971b06b7d5489d Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Sat, 25 Feb 2023 22:16:59 -0500 Subject: [PATCH] *Update dist --- dist/peer.d.ts | 4 +++- dist/peer.js | 5 ++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/dist/peer.d.ts b/dist/peer.d.ts index 02e239d..a8df0b1 100644 --- a/dist/peer.d.ts +++ b/dist/peer.d.ts @@ -14,6 +14,7 @@ export interface DataSocketOptions { onreceive?: OnReceive; onsend?: OnSend; onclose?: OnClose; + emulateWebsocket?: boolean; } export interface PeerOptions { peer: any; @@ -31,6 +32,7 @@ export default class Peer { private _onreceive; private _onsend; private _onclose; - constructor({ proxy, peer, muxer, onopen, onreceive, onsend, onclose, }: PeerOptionsWithProxy & DataSocketOptions); + private _emulateWebsocket; + constructor({ proxy, peer, muxer, onopen, onreceive, onsend, onclose, emulateWebsocket, }: PeerOptionsWithProxy & DataSocketOptions); init(): Promise; } diff --git a/dist/peer.js b/dist/peer.js index 8a190f5..30f554d 100644 --- a/dist/peer.js +++ b/dist/peer.js @@ -14,7 +14,8 @@ class Peer { _onreceive; _onsend; _onclose; - constructor({ proxy, peer, muxer, onopen, onreceive, onsend, onclose, }) { + _emulateWebsocket; + constructor({ proxy, peer, muxer, onopen, onreceive, onsend, onclose, emulateWebsocket = false, }) { this._proxy = proxy; this._peer = peer; this._muxer = muxer; @@ -22,6 +23,7 @@ class Peer { this._onreceive = onreceive; this._onsend = onsend; this._onclose = onclose; + this._emulateWebsocket = emulateWebsocket; } async init() { const write = async (data, cb) => { @@ -44,6 +46,7 @@ class Peer { remotePort: self._peer.rawStream.remotePort, remotePublicKey: self._peer.remotePublicKey, write, + emulateWebsocket: self._emulateWebsocket, }); self._socket.on("end", () => channel.close()); let ret = await self._onopen?.(self._socket, m);