diff --git a/README.md b/README.md index a5ed4b9..e917ca9 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,7 @@ webrtc 实现的 p2p 信道 - [x] 响应列表时不再广播 - [x] 对方退出时清除其列表 - [ ] 分片请求时立即播放 + - [ ] 上锁防止连续重复加载同一个造成分片混乱 - [ ] 集群分发 - [ ] 下载加速 - [ ] 即时通讯 diff --git a/public/client.js b/public/client.js index ed4bc8f..b499055 100644 --- a/public/client.js +++ b/public/client.js @@ -167,9 +167,7 @@ export default class ClientList { while (ch.readyState !== 'open') { await new Promise(resolve => setTimeout(resolve, 100)) } - console.log(ch.label, '通道已经打开, 开始发送数据') - const rest = ch.send(data) - console.log(ch.label, '通道发送已结束', rest) + ch.send(data) }) } // 通过指定通道发送数据(广播) diff --git a/public/index.html b/public/index.html index e8a668c..e983062 100644 --- a/public/index.html +++ b/public/index.html @@ -196,6 +196,12 @@ return } console.log('未知类型:', type) + }, + onclose: event => { + console.log('关闭信道', event.target.label) + }, + onerror: error => { + console.log('信道错误', error) } })