DEBUG Log

This commit is contained in:
2023-10-02 00:42:29 +08:00
parent 27cc201cc3
commit 5047a42457
1 changed files with 5 additions and 5 deletions

View File

@ -33,29 +33,29 @@ export default class ClientList {
} }
} }
webrtc.ondatachannel = ({ channel }) => { webrtc.ondatachannel = ({ channel }) => {
console.log('对方建立数据通道', channel.label) console.log('对方建立', channel.label, '数据通道')
const client = this.clientlist.find(x => x.id === data.id) const client = this.clientlist.find(x => x.id === data.id)
const option = this.channels[channel.label] const option = this.channels[channel.label]
channel.onopen = event => { channel.onopen = event => {
console.log('对方打开数据通道', channel.label) console.log('对方打开', channel.label, '数据通道')
if (option && option.onopen) { if (option && option.onopen) {
option.onopen(event, client) option.onopen(event, client)
} }
} }
channel.onmessage = event => { channel.onmessage = event => {
//console.log('对方发送数据消息', channel.label) console.log('对方发送', channel.label, '数据消息')
if (option && option.onmessage) { if (option && option.onmessage) {
option.onmessage(event, client) option.onmessage(event, client)
} }
} }
channel.onclose = event => { channel.onclose = event => {
console.log('对方关闭数据通道', channel.label) console.log('对方关闭', 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.log('对方数据通道发生错误', channel.label) console.log('对方通道', channel.label, '发生错误')
if (option && option.onerror) { if (option && option.onerror) {
option.onerror(event, client) option.onerror(event, client)
} }