移除错误消息

This commit is contained in:
2023-10-21 08:34:26 +08:00
parent 346adfe6b6
commit 9b0d418abc
1 changed files with 17 additions and 12 deletions

View File

@ -95,18 +95,18 @@ export default class ClientList {
option.onmessage(event, client) option.onmessage(event, client)
} }
} }
channel.onclose = event => { //channel.onclose = event => {
console.debug('对方关闭', channel.label, '数据通道') // console.debug('对方关闭', channel.label, '数据通道')
if (option && option.onclose) { // if (option && option.onclose) {
option.onclose(event, client) // option.onclose(event, client)
} // }
} //}
channel.onerror = event => { //channel.onerror = event => {
console.error(data.name, '通道', channel.label, '发生错误') // console.error(data.name, '通道', channel.label, '发生错误')
if (option && option.onerror) { // if (option && option.onerror) {
option.onerror(event, client) // option.onerror(event, client)
} // }
} //}
} }
webrtc.onicecandidate = event => { webrtc.onicecandidate = event => {
if (event.candidate) { if (event.candidate) {
@ -136,6 +136,11 @@ export default class ClientList {
}) })
return dc return dc
}) })
//// 页面刷新前主动关闭所有数据通道并关闭 WebRTC 连接
//window.addEventListener('beforeunload', event => {
// channels.forEach(ch => ch.close())
// webrtc.close()
//})
return { webrtc, channels } return { webrtc, channels }
} }
if (data.type === 'list') { if (data.type === 'list') {