我有一个使用 WebRTC DataChannels 的墙应用程序。在代码中,我已经成功地建立了连接,但是当对等点断开连接时我没有收到通知。在频道上,我有以下听众:
channels[uid].onerror = function( event ) {
console.log( 'channels[uid].onerror', uid, arguments )
removePeer( uid )
}
channels[uid].onclose = function() {
console.log( 'channels[uid].onclose', uid, arguments )
removePeer( uid )
}
Run Code Online (Sandbox Code Playgroud)
当我重新加载选项卡以断开对等方的连接时,我没有收到关闭消息。当我发送给他们时,我没有收到错误。
小智 3
目前,这是由于实施不完整所致 - 不幸的是,关闭事件并不总是为数据通道触发。
对于 Chrome: https:
//code.google.com/p/webrtc/issues/detail?id=1676