@libp2p/webrtc 5.2.23-cf9aab5c8 → 5.2.24-a02cb0461
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/README.md +10 -20
- package/dist/index.min.js +14 -14
- package/dist/index.min.js.map +4 -4
- package/dist/src/constants.d.ts +0 -15
- package/dist/src/constants.d.ts.map +1 -1
- package/dist/src/constants.js +0 -15
- package/dist/src/constants.js.map +1 -1
- package/dist/src/index.d.ts +12 -22
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +12 -22
- package/dist/src/index.js.map +1 -1
- package/dist/src/muxer.d.ts +14 -46
- package/dist/src/muxer.d.ts.map +1 -1
- package/dist/src/muxer.js +32 -135
- package/dist/src/muxer.js.map +1 -1
- package/dist/src/private-to-private/initiate-connection.d.ts +3 -4
- package/dist/src/private-to-private/initiate-connection.d.ts.map +1 -1
- package/dist/src/private-to-private/initiate-connection.js +23 -5
- package/dist/src/private-to-private/initiate-connection.js.map +1 -1
- package/dist/src/private-to-private/signaling-stream-handler.d.ts +4 -4
- package/dist/src/private-to-private/signaling-stream-handler.d.ts.map +1 -1
- package/dist/src/private-to-private/signaling-stream-handler.js +10 -6
- package/dist/src/private-to-private/signaling-stream-handler.js.map +1 -1
- package/dist/src/private-to-private/transport.d.ts +2 -2
- package/dist/src/private-to-private/transport.d.ts.map +1 -1
- package/dist/src/private-to-private/transport.js +30 -15
- package/dist/src/private-to-private/transport.js.map +1 -1
- package/dist/src/private-to-private/util.d.ts +3 -1
- package/dist/src/private-to-private/util.d.ts.map +1 -1
- package/dist/src/private-to-private/util.js +15 -3
- package/dist/src/private-to-private/util.js.map +1 -1
- package/dist/src/private-to-public/listener.js +2 -2
- package/dist/src/private-to-public/listener.js.map +1 -1
- package/dist/src/private-to-public/transport.js +1 -1
- package/dist/src/private-to-public/transport.js.map +1 -1
- package/dist/src/private-to-public/utils/connect.d.ts +1 -1
- package/dist/src/private-to-public/utils/connect.d.ts.map +1 -1
- package/dist/src/private-to-public/utils/connect.js +17 -14
- package/dist/src/private-to-public/utils/connect.js.map +1 -1
- package/dist/src/private-to-public/utils/get-rtcpeerconnection.d.ts +4 -4
- package/dist/src/private-to-public/utils/get-rtcpeerconnection.d.ts.map +1 -1
- package/dist/src/private-to-public/utils/get-rtcpeerconnection.js +13 -2
- package/dist/src/private-to-public/utils/get-rtcpeerconnection.js.map +1 -1
- package/dist/src/private-to-public/utils/sdp.d.ts.map +1 -1
- package/dist/src/private-to-public/utils/sdp.js +8 -3
- package/dist/src/private-to-public/utils/sdp.js.map +1 -1
- package/dist/src/private-to-public/utils/stun-listener.js +1 -1
- package/dist/src/private-to-public/utils/stun-listener.js.map +1 -1
- package/dist/src/rtcpeerconnection-to-conn.d.ts +12 -0
- package/dist/src/rtcpeerconnection-to-conn.d.ts.map +1 -0
- package/dist/src/rtcpeerconnection-to-conn.js +43 -0
- package/dist/src/rtcpeerconnection-to-conn.js.map +1 -0
- package/dist/src/stream.d.ts +13 -26
- package/dist/src/stream.d.ts.map +1 -1
- package/dist/src/stream.js +64 -166
- package/dist/src/stream.js.map +1 -1
- package/dist/src/util.d.ts +3 -1
- package/dist/src/util.d.ts.map +1 -1
- package/dist/src/util.js +19 -0
- package/dist/src/util.js.map +1 -1
- package/dist/src/webrtc/index.d.ts +1 -1
- package/dist/src/webrtc/index.d.ts.map +1 -1
- package/dist/src/webrtc/index.js +1 -1
- package/dist/src/webrtc/index.js.map +1 -1
- package/package.json +26 -29
- package/src/constants.ts +0 -18
- package/src/index.ts +12 -22
- package/src/muxer.ts +43 -166
- package/src/private-to-private/initiate-connection.ts +31 -9
- package/src/private-to-private/signaling-stream-handler.ts +12 -9
- package/src/private-to-private/transport.ts +33 -17
- package/src/private-to-private/util.ts +21 -4
- package/src/private-to-public/listener.ts +2 -2
- package/src/private-to-public/transport.ts +1 -1
- package/src/private-to-public/utils/connect.ts +18 -15
- package/src/private-to-public/utils/get-rtcpeerconnection.ts +16 -4
- package/src/private-to-public/utils/sdp.ts +8 -3
- package/src/private-to-public/utils/stun-listener.ts +1 -1
- package/src/rtcpeerconnection-to-conn.ts +62 -0
- package/src/stream.ts +74 -194
- package/src/util.ts +22 -1
- package/src/webrtc/index.ts +1 -1
- package/dist/src/maconn.d.ts +0 -58
- package/dist/src/maconn.d.ts.map +0 -1
- package/dist/src/maconn.js +0 -56
- package/dist/src/maconn.js.map +0 -1
- package/src/maconn.ts +0 -101
package/src/util.ts
CHANGED
@@ -2,8 +2,9 @@ import { detect } from 'detect-browser'
|
|
2
2
|
import pDefer from 'p-defer'
|
3
3
|
import pTimeout from 'p-timeout'
|
4
4
|
import { DATA_CHANNEL_DRAIN_TIMEOUT, DEFAULT_ICE_SERVERS, UFRAG_ALPHABET, UFRAG_PREFIX } from './constants.js'
|
5
|
-
import type { PeerConnection } from '@ipshipyard/node-datachannel'
|
6
5
|
import type { LoggerOptions } from '@libp2p/interface'
|
6
|
+
import type { Duplex, Source } from 'it-stream-types'
|
7
|
+
import type { PeerConnection } from 'node-datachannel'
|
7
8
|
|
8
9
|
const browser = detect()
|
9
10
|
export const isFirefox = ((browser != null) && browser.name === 'firefox')
|
@@ -12,6 +13,26 @@ export const nopSource = async function * nop (): AsyncGenerator<Uint8Array, any
|
|
12
13
|
|
13
14
|
export const nopSink = async (_: any): Promise<void> => {}
|
14
15
|
|
16
|
+
// Duplex that does nothing. Needed to fulfill the interface
|
17
|
+
export function inertDuplex (): Duplex<any, any, any> {
|
18
|
+
return {
|
19
|
+
source: {
|
20
|
+
[Symbol.asyncIterator] () {
|
21
|
+
return {
|
22
|
+
async next () {
|
23
|
+
// This will never resolve
|
24
|
+
return new Promise(() => { })
|
25
|
+
}
|
26
|
+
}
|
27
|
+
}
|
28
|
+
},
|
29
|
+
sink: async (source: Source<any>) => {
|
30
|
+
// This will never resolve
|
31
|
+
return new Promise(() => { })
|
32
|
+
}
|
33
|
+
}
|
34
|
+
}
|
35
|
+
|
15
36
|
export function drainAndClose (channel: RTCDataChannel, direction: string, drainTimeout: number = DATA_CHANNEL_DRAIN_TIMEOUT, options: LoggerOptions): void {
|
16
37
|
if (channel.readyState !== 'open') {
|
17
38
|
return
|
package/src/webrtc/index.ts
CHANGED
@@ -1 +1 @@
|
|
1
|
-
export { RTCSessionDescription, RTCIceCandidate, RTCPeerConnection } from '
|
1
|
+
export { RTCSessionDescription, RTCIceCandidate, RTCPeerConnection } from 'node-datachannel/polyfill'
|
package/dist/src/maconn.d.ts
DELETED
@@ -1,58 +0,0 @@
|
|
1
|
-
import type { RTCPeerConnection } from './webrtc/index.js';
|
2
|
-
import type { ComponentLogger, Logger, MultiaddrConnection, MultiaddrConnectionTimeline, CounterGroup } from '@libp2p/interface';
|
3
|
-
import type { AbortOptions, Multiaddr } from '@multiformats/multiaddr';
|
4
|
-
import type { Source, Sink } from 'it-stream-types';
|
5
|
-
import type { Uint8ArrayList } from 'uint8arraylist';
|
6
|
-
interface WebRTCMultiaddrConnectionInit {
|
7
|
-
/**
|
8
|
-
* WebRTC Peer Connection
|
9
|
-
*/
|
10
|
-
peerConnection: RTCPeerConnection;
|
11
|
-
/**
|
12
|
-
* The multiaddr address used to communicate with the remote peer
|
13
|
-
*/
|
14
|
-
remoteAddr: Multiaddr;
|
15
|
-
/**
|
16
|
-
* Holds the relevant events timestamps of the connection
|
17
|
-
*/
|
18
|
-
timeline: MultiaddrConnectionTimeline;
|
19
|
-
/**
|
20
|
-
* Optional metrics counter group for this connection
|
21
|
-
*/
|
22
|
-
metrics?: CounterGroup;
|
23
|
-
}
|
24
|
-
export interface WebRTCMultiaddrConnectionComponents {
|
25
|
-
logger: ComponentLogger;
|
26
|
-
}
|
27
|
-
export declare class WebRTCMultiaddrConnection implements MultiaddrConnection {
|
28
|
-
readonly log: Logger;
|
29
|
-
/**
|
30
|
-
* WebRTC Peer Connection
|
31
|
-
*/
|
32
|
-
readonly peerConnection: RTCPeerConnection;
|
33
|
-
/**
|
34
|
-
* The multiaddr address used to communicate with the remote peer
|
35
|
-
*/
|
36
|
-
remoteAddr: Multiaddr;
|
37
|
-
/**
|
38
|
-
* Holds the life cycle times of the connection
|
39
|
-
*/
|
40
|
-
timeline: MultiaddrConnectionTimeline;
|
41
|
-
/**
|
42
|
-
* Optional metrics counter group for this connection
|
43
|
-
*/
|
44
|
-
metrics?: CounterGroup;
|
45
|
-
/**
|
46
|
-
* The stream source, a no-op as the transport natively supports multiplexing
|
47
|
-
*/
|
48
|
-
source: AsyncGenerator<Uint8Array, any, unknown>;
|
49
|
-
/**
|
50
|
-
* The stream destination, a no-op as the transport natively supports multiplexing
|
51
|
-
*/
|
52
|
-
sink: Sink<Source<Uint8Array | Uint8ArrayList>, Promise<void>>;
|
53
|
-
constructor(components: WebRTCMultiaddrConnectionComponents, init: WebRTCMultiaddrConnectionInit);
|
54
|
-
close(options?: AbortOptions): Promise<void>;
|
55
|
-
abort(err: Error): void;
|
56
|
-
}
|
57
|
-
export {};
|
58
|
-
//# sourceMappingURL=maconn.d.ts.map
|
package/dist/src/maconn.d.ts.map
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"maconn.d.ts","sourceRoot":"","sources":["../../src/maconn.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAA;AAC1D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,EAAE,mBAAmB,EAAE,2BAA2B,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAChI,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAA;AACtE,OAAO,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAA;AACnD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAEpD,UAAU,6BAA6B;IACrC;;OAEG;IACH,cAAc,EAAE,iBAAiB,CAAA;IAEjC;;OAEG;IACH,UAAU,EAAE,SAAS,CAAA;IAErB;;OAEG;IACH,QAAQ,EAAE,2BAA2B,CAAA;IAErC;;OAEG;IACH,OAAO,CAAC,EAAE,YAAY,CAAA;CACvB;AAED,MAAM,WAAW,mCAAmC;IAClD,MAAM,EAAE,eAAe,CAAA;CACxB;AAED,qBAAa,yBAA0B,YAAW,mBAAmB;IACnE,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;IAEpB;;OAEG;IACH,QAAQ,CAAC,cAAc,EAAE,iBAAiB,CAAA;IAE1C;;OAEG;IACH,UAAU,EAAE,SAAS,CAAA;IAErB;;OAEG;IACH,QAAQ,EAAE,2BAA2B,CAAA;IAErC;;OAEG;IACH,OAAO,CAAC,EAAE,YAAY,CAAA;IAEtB;;OAEG;IACH,MAAM,EAAE,cAAc,CAAC,UAAU,EAAE,GAAG,EAAE,OAAO,CAAC,CAAc;IAE9D;;OAEG;IACH,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,UAAU,GAAG,cAAc,CAAC,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAU;gBAE3D,UAAU,EAAE,mCAAmC,EAAE,IAAI,EAAE,6BAA6B;IAmB3F,KAAK,CAAE,OAAO,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC;IAQnD,KAAK,CAAE,GAAG,EAAE,KAAK,GAAG,IAAI;CAOzB"}
|
package/dist/src/maconn.js
DELETED
@@ -1,56 +0,0 @@
|
|
1
|
-
import { nopSink, nopSource } from './util.js';
|
2
|
-
export class WebRTCMultiaddrConnection {
|
3
|
-
log;
|
4
|
-
/**
|
5
|
-
* WebRTC Peer Connection
|
6
|
-
*/
|
7
|
-
peerConnection;
|
8
|
-
/**
|
9
|
-
* The multiaddr address used to communicate with the remote peer
|
10
|
-
*/
|
11
|
-
remoteAddr;
|
12
|
-
/**
|
13
|
-
* Holds the life cycle times of the connection
|
14
|
-
*/
|
15
|
-
timeline;
|
16
|
-
/**
|
17
|
-
* Optional metrics counter group for this connection
|
18
|
-
*/
|
19
|
-
metrics;
|
20
|
-
/**
|
21
|
-
* The stream source, a no-op as the transport natively supports multiplexing
|
22
|
-
*/
|
23
|
-
source = nopSource();
|
24
|
-
/**
|
25
|
-
* The stream destination, a no-op as the transport natively supports multiplexing
|
26
|
-
*/
|
27
|
-
sink = nopSink;
|
28
|
-
constructor(components, init) {
|
29
|
-
this.log = components.logger.forComponent('libp2p:webrtc:maconn');
|
30
|
-
this.remoteAddr = init.remoteAddr;
|
31
|
-
this.timeline = init.timeline;
|
32
|
-
this.peerConnection = init.peerConnection;
|
33
|
-
const peerConnection = this.peerConnection;
|
34
|
-
const initialState = peerConnection.connectionState;
|
35
|
-
this.peerConnection.onconnectionstatechange = () => {
|
36
|
-
this.log.trace('peer connection state change', peerConnection.connectionState, 'initial state', initialState);
|
37
|
-
if (peerConnection.connectionState === 'disconnected' || peerConnection.connectionState === 'failed' || peerConnection.connectionState === 'closed') {
|
38
|
-
// nothing else to do but close the connection
|
39
|
-
this.timeline.close = Date.now();
|
40
|
-
}
|
41
|
-
};
|
42
|
-
}
|
43
|
-
async close(options) {
|
44
|
-
this.log.trace('closing connection');
|
45
|
-
this.peerConnection.close();
|
46
|
-
this.timeline.close = Date.now();
|
47
|
-
this.metrics?.increment({ close: true });
|
48
|
-
}
|
49
|
-
abort(err) {
|
50
|
-
this.log.error('closing connection due to error', err);
|
51
|
-
this.peerConnection.close();
|
52
|
-
this.timeline.close = Date.now();
|
53
|
-
this.metrics?.increment({ abort: true });
|
54
|
-
}
|
55
|
-
}
|
56
|
-
//# sourceMappingURL=maconn.js.map
|
package/dist/src/maconn.js.map
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"maconn.js","sourceRoot":"","sources":["../../src/maconn.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAA;AAiC9C,MAAM,OAAO,yBAAyB;IAC3B,GAAG,CAAQ;IAEpB;;OAEG;IACM,cAAc,CAAmB;IAE1C;;OAEG;IACH,UAAU,CAAW;IAErB;;OAEG;IACH,QAAQ,CAA6B;IAErC;;OAEG;IACH,OAAO,CAAe;IAEtB;;OAEG;IACH,MAAM,GAA6C,SAAS,EAAE,CAAA;IAE9D;;OAEG;IACH,IAAI,GAA6D,OAAO,CAAA;IAExE,YAAa,UAA+C,EAAE,IAAmC;QAC/F,IAAI,CAAC,GAAG,GAAG,UAAU,CAAC,MAAM,CAAC,YAAY,CAAC,sBAAsB,CAAC,CAAA;QACjE,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,CAAA;QACjC,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAA;QAC7B,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,cAAc,CAAA;QAEzC,MAAM,cAAc,GAAG,IAAI,CAAC,cAAc,CAAA;QAC1C,MAAM,YAAY,GAAG,cAAc,CAAC,eAAe,CAAA;QAEnD,IAAI,CAAC,cAAc,CAAC,uBAAuB,GAAG,GAAG,EAAE;YACjD,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,8BAA8B,EAAE,cAAc,CAAC,eAAe,EAAE,eAAe,EAAE,YAAY,CAAC,CAAA;YAE7G,IAAI,cAAc,CAAC,eAAe,KAAK,cAAc,IAAI,cAAc,CAAC,eAAe,KAAK,QAAQ,IAAI,cAAc,CAAC,eAAe,KAAK,QAAQ,EAAE,CAAC;gBACpJ,8CAA8C;gBAC9C,IAAI,CAAC,QAAQ,CAAC,KAAK,GAAG,IAAI,CAAC,GAAG,EAAE,CAAA;YAClC,CAAC;QACH,CAAC,CAAA;IACH,CAAC;IAED,KAAK,CAAC,KAAK,CAAE,OAAsB;QACjC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,oBAAoB,CAAC,CAAA;QAEpC,IAAI,CAAC,cAAc,CAAC,KAAK,EAAE,CAAA;QAC3B,IAAI,CAAC,QAAQ,CAAC,KAAK,GAAG,IAAI,CAAC,GAAG,EAAE,CAAA;QAChC,IAAI,CAAC,OAAO,EAAE,SAAS,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAA;IAC1C,CAAC;IAED,KAAK,CAAE,GAAU;QACf,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,iCAAiC,EAAE,GAAG,CAAC,CAAA;QAEtD,IAAI,CAAC,cAAc,CAAC,KAAK,EAAE,CAAA;QAC3B,IAAI,CAAC,QAAQ,CAAC,KAAK,GAAG,IAAI,CAAC,GAAG,EAAE,CAAA;QAChC,IAAI,CAAC,OAAO,EAAE,SAAS,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAA;IAC1C,CAAC;CACF"}
|
package/src/maconn.ts
DELETED
@@ -1,101 +0,0 @@
|
|
1
|
-
import { nopSink, nopSource } from './util.js'
|
2
|
-
import type { RTCPeerConnection } from './webrtc/index.js'
|
3
|
-
import type { ComponentLogger, Logger, MultiaddrConnection, MultiaddrConnectionTimeline, CounterGroup } from '@libp2p/interface'
|
4
|
-
import type { AbortOptions, Multiaddr } from '@multiformats/multiaddr'
|
5
|
-
import type { Source, Sink } from 'it-stream-types'
|
6
|
-
import type { Uint8ArrayList } from 'uint8arraylist'
|
7
|
-
|
8
|
-
interface WebRTCMultiaddrConnectionInit {
|
9
|
-
/**
|
10
|
-
* WebRTC Peer Connection
|
11
|
-
*/
|
12
|
-
peerConnection: RTCPeerConnection
|
13
|
-
|
14
|
-
/**
|
15
|
-
* The multiaddr address used to communicate with the remote peer
|
16
|
-
*/
|
17
|
-
remoteAddr: Multiaddr
|
18
|
-
|
19
|
-
/**
|
20
|
-
* Holds the relevant events timestamps of the connection
|
21
|
-
*/
|
22
|
-
timeline: MultiaddrConnectionTimeline
|
23
|
-
|
24
|
-
/**
|
25
|
-
* Optional metrics counter group for this connection
|
26
|
-
*/
|
27
|
-
metrics?: CounterGroup
|
28
|
-
}
|
29
|
-
|
30
|
-
export interface WebRTCMultiaddrConnectionComponents {
|
31
|
-
logger: ComponentLogger
|
32
|
-
}
|
33
|
-
|
34
|
-
export class WebRTCMultiaddrConnection implements MultiaddrConnection {
|
35
|
-
readonly log: Logger
|
36
|
-
|
37
|
-
/**
|
38
|
-
* WebRTC Peer Connection
|
39
|
-
*/
|
40
|
-
readonly peerConnection: RTCPeerConnection
|
41
|
-
|
42
|
-
/**
|
43
|
-
* The multiaddr address used to communicate with the remote peer
|
44
|
-
*/
|
45
|
-
remoteAddr: Multiaddr
|
46
|
-
|
47
|
-
/**
|
48
|
-
* Holds the life cycle times of the connection
|
49
|
-
*/
|
50
|
-
timeline: MultiaddrConnectionTimeline
|
51
|
-
|
52
|
-
/**
|
53
|
-
* Optional metrics counter group for this connection
|
54
|
-
*/
|
55
|
-
metrics?: CounterGroup
|
56
|
-
|
57
|
-
/**
|
58
|
-
* The stream source, a no-op as the transport natively supports multiplexing
|
59
|
-
*/
|
60
|
-
source: AsyncGenerator<Uint8Array, any, unknown> = nopSource()
|
61
|
-
|
62
|
-
/**
|
63
|
-
* The stream destination, a no-op as the transport natively supports multiplexing
|
64
|
-
*/
|
65
|
-
sink: Sink<Source<Uint8Array | Uint8ArrayList>, Promise<void>> = nopSink
|
66
|
-
|
67
|
-
constructor (components: WebRTCMultiaddrConnectionComponents, init: WebRTCMultiaddrConnectionInit) {
|
68
|
-
this.log = components.logger.forComponent('libp2p:webrtc:maconn')
|
69
|
-
this.remoteAddr = init.remoteAddr
|
70
|
-
this.timeline = init.timeline
|
71
|
-
this.peerConnection = init.peerConnection
|
72
|
-
|
73
|
-
const peerConnection = this.peerConnection
|
74
|
-
const initialState = peerConnection.connectionState
|
75
|
-
|
76
|
-
this.peerConnection.onconnectionstatechange = () => {
|
77
|
-
this.log.trace('peer connection state change', peerConnection.connectionState, 'initial state', initialState)
|
78
|
-
|
79
|
-
if (peerConnection.connectionState === 'disconnected' || peerConnection.connectionState === 'failed' || peerConnection.connectionState === 'closed') {
|
80
|
-
// nothing else to do but close the connection
|
81
|
-
this.timeline.close = Date.now()
|
82
|
-
}
|
83
|
-
}
|
84
|
-
}
|
85
|
-
|
86
|
-
async close (options?: AbortOptions): Promise<void> {
|
87
|
-
this.log.trace('closing connection')
|
88
|
-
|
89
|
-
this.peerConnection.close()
|
90
|
-
this.timeline.close = Date.now()
|
91
|
-
this.metrics?.increment({ close: true })
|
92
|
-
}
|
93
|
-
|
94
|
-
abort (err: Error): void {
|
95
|
-
this.log.error('closing connection due to error', err)
|
96
|
-
|
97
|
-
this.peerConnection.close()
|
98
|
-
this.timeline.close = Date.now()
|
99
|
-
this.metrics?.increment({ abort: true })
|
100
|
-
}
|
101
|
-
}
|