MCPcopy Create free account
hub / github.com/ShouChenICU/FastSend / constructor

Method constructor

app/utils/PeerDataChannel.ts:44–54  ·  view source on GitHub ↗

* 创建一个新的 PeerDataChannel 实例 * @param config 配置

(config: PeerDataChannelConfig = {})

Source from the content-addressed store, hash-verified

42 * @param config 配置
43 */
44 constructor(config: PeerDataChannelConfig = {}) {
45 this.blockSize = config.blockSize || PeerDataChannel.DEFAULT_BLOCK_SIZE
46 this.eventQueue = new EventQueue(this.onData.bind(this))
47 this.pc = new RTCPeerConnection({ iceServers: config.iceServers })
48
49 this.setupPeerConnection()
50
51 if (config.initializeDataChannel) {
52 this.initializeDataChannel()
53 }
54 }
55
56 private setupPeerConnection(): void {
57 this.pc.ondatachannel = this.handleDataChannel.bind(this)

Callers

nothing calls this directly

Calls 2

setupPeerConnectionMethod · 0.95
initializeDataChannelMethod · 0.95

Tested by

no test coverage detected